multiple insert data in one table

70 Views Asked by At

I have 120 student in 4 class A,B,C,D in student table : Id_student, Name, Class and I have a payment table: Id, Id_student, Class, Payment, Date_payment, Status How i asking how to insert All student in class A with status not_complete

2

There are 2 best solutions below

0
GokulnathP On BEST ANSWER
INSERT INTO payment (Id_student, Class, Status)
SELECT Id_student, Class, "not_complete" AS Status
FROM student
WHERE Class = "A";

Refer this link for more information.

0
Priyanka Nigam On

insert all into payment values(R1001,'A',"not complete") into payment values(S1002,'B',"not complete") into payment values(T1003,'C',"not complete") into payment values(T1003,'C',"not complete") into payment values(Z1003,'D',"not complete") ............ Update payment set class='A' where class in('B','C','D'); SELECT Id_student, Class, Status FROM payment WHERE Class = "A";