Tuesday, 15 January 2013

db2 - Joining two queries -



db2 - Joining two queries -

all, need help joining info 2 select statement in db2.

first query is,

select distinct(employeename) table1 a, table2 b, table3 c a.employeeid=b.employeeid , b.employeenum=c.employeenum

now, result first query employeename need joined sec query

select * table4 d, table5 e, **firstquaryresult**.f , d.employeename=e.employeename , e.employeename= f.employeename

any lead how can accomplish this.

thanks.

this should trick :

step 1 : //insert info of first query in temp table insert temptable select distinct(employeename) table1 a, table2 b, table3 c a.employeeid=b.employeeid , b.employeenum=c.employeenum

step 2 : //select info d e , temptable f select * table4 d, table5 e, temptable f , d.employeename=e.employeename , e.employeename= f.employeename

db2

No comments:

Post a Comment