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 |
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2003-05-29 : 20:09:30
|
| How do I do this in a single query?select *into #tempfrom Packaging2MTXwhere mtxid = 13SELECT PackagingList.packID, PackagingList.desc1, #temp.mtxIDFROM PackagingList LEFT OUTER JOIN #temp ON PackagingList.packID = #temp.packIDdrop Table #temp---------------------------I want to end up with this, which I dont if I just do a left join. In other words, I want the nulls to appear:packid desc1 mtxID1 BP, KSP & MSP 132 BP, USP Levers NULL3 BP, USP KI Knobs NULL4 CP, USP Domestic NULL5 CP, USP International 13 |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2003-05-29 : 20:47:18
|
| SELECT PackagingList.packID, PackagingList.desc1, X.mtxIDFROM PackagingListLEFT OUTER JOIN (select *from Packaging2MTXwhere mtxid = 13) X -- Gotta name the nested queryON PackagingList.packID = X.packID Is this it?Sam |
 |
|
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2003-05-29 : 21:50:05
|
| That does the trick! Thanks! |
 |
|
|
|
|
|