Joining Three Tables in Sql Server
Hi,my requirement is i want to join three tables in which first and second table are related and second and third tables are related.I want to get data from all three tables so how it is possible.
Pls send me some reply.
# 1 Re: Joining Three Tables in Sql Server
It actually depends on what kind of relationship these tables have. A simple one would be Select
TABLE1.*, TABLE2.*, TABLE3.*
From
TABLE1
Inner Join TABLE2 On
TABLE1.ID = TABLE2.ID
Inner Join TABLE3 On
TABLE2.ID = TABLE3.ID
# 2 Re: Joining Three Tables in Sql Server
Thanx for ur reply, if possible just this query and tell me wt is wrong in this,
select PurPRMaster.*,StkItemMaster.Name as IName,StkItemMaster.Unit,PurPRTrans.* FROM PurPRMaster
inner join purOrderMaster on PurPrmaster.prno=PurOrderMaster.prno
inner join purprtrans on purmaster.id=purtrans.mastid
inner join StkItemMaster on StkItemMaster.Code=PurPRTrans.ItemCode
It is doing cross multiplication.
wt could be the reason.
Thanks in advance.