2021-02-28

Insert to Multiple tables using Select statment?

I am trying to do mysql copy & paste statement.

I have MySQL table like this:

Table 1: Employee
empid  F_Name      L_Name    Email 
1      Nitin       Varpe     fedexnit@gmail.com
2      Prashant    Bankar    pbankar@yahoo.com
Table 1: salary
salaryid  empid    Month       Salary 
1         1        Feb 2021    fedexnit@gmail.com
2         2        Feb 2021    pbankar@yahoo.com

Suppose if I click copy and paste button I should get following output:

Table 1: Employee
empid  F_Name      L_Name    Email 
1      Nitin       Varpe     fedexnit@gmail.com
2      Prashant    Bankar    pbankar@yahoo.com
3      Nitin       Varpe     fedexnit@gmail.com
4      Prashant    Bankar    pbankar@yahoo.com
Table 1: salary
salaryid  empid    Month       Salary 
1         1        Feb 2021    1000
2         2        Feb 2021    2000
3         3        Feb 2021    1000
4         4        Feb 2021    2000

It should insert to the same table with different id. I used INSERT INTO Employee SELECT statement but it is not working. Kindly give us perfect mysql statement.



from Recent Questions - Stack Overflow https://ift.tt/2ZYjNVW
https://ift.tt/eA8V8J

No comments:

Post a Comment