How can i write join query for three tables. [Resolved]

Posted by Joewilliam under Sql Server on 6/20/2011 | Points: 10 | Views : 9686 | Status : [Member] | Replies : 6
How can i write join query for three tables. Could you explain with samples.

William Mary


Responses

Posted by: Ndebata on: 6/20/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi
Take a look at this blog
http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 6/20/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
select f.col,f.col1..... ,s.col,s.col1 ..... from table1 inner join table2 on f.col=s.col inner join table3 on f.col or s.col=t.col  where f.col=something


Thanks&Regards
LakshmiNarayana Nalluri.

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vilasgite080 on: 6/20/2011 [Member] Starter | Points: 25

Up
0
Down
hi william
please see here......more than 3 tables in joins

http://msdn.microsoft.com/en-us/library/ms191430(v=sql.90).aspx

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 11/24/2011 [Member] Starter | Points: 25

Up
0
Down
select * from employee inner join empsalary employee.empid=empsalary.empid inner join

empdetails where empid=1001


hope this will help

Regards
Sriram.R

sriram

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/20/2012 [Member] Starter | Points: 25

Up
0
Down
SELECT * FROM TABLE1


INNER JOIN TABLE2 ON TABLE1.COLUMNNAME=TABLE2.COLUMNNAME

JOIN

TABLE3 ON TABLE2.COLUMNNAME=TABLE3.COLUMNNAME

WHERE TABLE2.COLUMNNAME='XYZ'

REGARDS

sriram

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 5/21/2012 [Member] Starter | Points: 25

Up
0
Down
SELECT *
FROM TABLE1
INNER JOIN Table2 on TABLE1.PID = Table2.FID
INNER JOIN Table3 on Table1.Pid = Table3.Fid

Ajay
ajaypatelfromsanthal.blogspot.in

Joewilliam, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response