Tuesday, June 21, 2005

Multiple Records Insert - SQL query

This query also works in MS Access. Hope the same query runs in DB2 also.

insert into Email_TableR (EmpID,EmailID,Active) select T1.EmpID,T1.EmailID,T1.Active from Email_Table1 T1,Email_Table2 T2 where T1.EmpID = T2.EmpID;

Muruganandham Krishnan

From: Pavadaidurai A

Thanks vk....

From: Karthigeyan Velou (Tata Consultancy Services) [mailto:v-kvelou@microsoft.com]

Hi Durai,

Check this one

insert into tab1

select * from tab2

where exists

( select * from tab3

where tab2.student = tab3.student)

Regards,
vk

From: chandramouly.rathinasababathy@oracle.com

durai pls try out this !!!
insert all into table1(student)
select student from table2
intersect select student from table3;

end mouly

From: Pavadaidurai A [mailto:Pavadaidurai_A@infosys.com]



This is somewhat similar to multiple records insert...

I dont remember the syntax .....

can anybody help me out for this....

From: Pavadaidurai A

Friends,

Please help me out this is urgent....
I have three tables table1 ,table2 and table3
all these tables have a single column with same datatype and same name(say 'student')
i want to insert the all the rows which are common in table2 and table3 into table1......
please give me a query for this

0 Comments:

Post a Comment

<< Home