0

how to join left join of different tables

1st Jul 2016, 4:49 PM
srihari bulagakula
13 Respostas
0
suppose there are 3 tables : one, two, three then query will be SELECT o.columnname FROM one o LEFT JOIN two t ON o.id = t.id LEFT JOIN threr th ON th.id = o.id considering three tables are linked with each other via id
1st Jul 2016, 4:57 PM
ashu
0
in db2 database
1st Jul 2016, 5:01 PM
srihari bulagakula
0
you mean to say create a join from two different databases?
1st Jul 2016, 5:03 PM
ashu
0
no. I have 3 tables in db2 and need to get result like. in first table I need Column one and second table 2 column and third table I need 3 column , how can use left join to get desired result
1st Jul 2016, 5:07 PM
srihari bulagakula
0
SELECT o.columnname, t.columnname, th.columnname FROM one o LEFT JOIN two t ON o.id = t.id LEFT JOIN threr th ON th.id = o.id just select the columns as above by using table aliases
1st Jul 2016, 5:10 PM
ashu
0
for more detail please give me the tables name and columns name you want to select and relation column between these three
1st Jul 2016, 5:11 PM
ashu
0
in three tables I have unique I'd I,e employeeid
1st Jul 2016, 5:13 PM
srihari bulagakula
0
ok then just use table aliases and employeeid at ON clause like ON o.employeeid = t.employeeid
1st Jul 2016, 5:16 PM
ashu
0
I tried that query is executing but result unable to get querying the I did some thing wrong , it is very helpful to me if you write complete query
1st Jul 2016, 5:18 PM
srihari bulagakula
0
please post your query
1st Jul 2016, 5:18 PM
ashu
0
OK tomorrow I will post my how I am doing the query
1st Jul 2016, 5:21 PM
srihari bulagakula
0
thank you
1st Jul 2016, 5:21 PM
srihari bulagakula
0
no problem
1st Jul 2016, 5:22 PM
ashu