Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all..
i have 3 tables called itemMaster,ItemWh,whWiseItem(table names i took just for example). here i want to retrieve data from all the 3 tables.

table details
itemMaster having details of Item means Code,Description,UOM etc.
ItemWh-items fro perticular store.
whWiseItem-also transactions for perticular store with item code

what i want is, i want to take items details from itemMaster and items for perticular store from both ItemWh and whWiseItem.

all the tables having ItemCode.

i know how to combine two tables using JOIN. but how can i combine 3 tables.


SELECT whWiseItem.ItemId,itemMaster.ItemDescription,
itemMaster.UnitPrice,
 FROM whWiseItem
 inner join itemMaster on whWiseItem.ItemID=itemMaster.ItemId 
where WhseId='001'


i want to take items in ItemWh which are not in whWiseItem table. please help me to do this im really confuse.

thank you all
Posted

1 solution

SQL
SELECT whWiseItem.ItemId,itemMaster.ItemDescription,
itemMaster.UnitPrice, ItemWh./*your column here*/
 FROM whWiseItem
 inner join itemMaster on whWiseItem.ItemID=itemMaster.ItemId 
 inner join ItemWh on whWiseItem.ItemID = ItemWh.ItemID  -- just add this join

where WhseId='001'
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900