Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2009-11-10 : 07:00:38
|
| I have two tables 1)LocationMaster with fields locationId,locationName2)LocationProductQuantity with fields locationId,productName,QuantityHow can I make a select command such that I will result location quantity for each product (0 if no entry in LocationProcuctQuantity for a location)ie if LocationMaster contains locationId locationName1 Loc1 2 Loc2 3 Loc3and LocationProductQuantity containslocationId productName Quanity1 pen 102 pen 202 book 53 book 40It should show asLoc1 pen 10Loc2 pen 20Loc3 pen 0Loc1 book 0Loc2 book 5Loc3 book 40Thanks and Regards Anu Palavila |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-11-10 : 07:19:44
|
| select t1.locationid,t2.productname,isnull(t2.quantity,0) from LocationMaster as t1 left join LocationProductQuantity as t2 on t1.locationid=t2.locationidMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|