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 |
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2011-01-17 : 10:13:35
|
| I'm working with two tables. IMINVLOCIMINVBINI want a select statement that will show me what records exist in the IMINVLOC that are not present in the IMINVBIN. These two tables will link on item_no and locselect iminvloc_sql.item_nofrom ??? |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-01-17 : 10:19:14
|
| SELECT LOC.*FROM IMINVLOC LOCLEFT JOIN IMINVBIN BINON loc.item_no = bin.item_noand loc.loc = bin.locWHERE bin.loc is null or bin.loc is nullSELECT loc.*FROM IMINVLOC LOCWHERE NOT EXISTS(select 1 from IMINVBIN BIN where loc.item_no = bin.item_no and loc.loc = bin.loc )JimEveryday I learn something that somebody else already knew |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-01-18 : 09:00:33
|
| From versions 2005 onwards you can use EXCEPT operator tooselect * from IMINVLOCexceptselect * from IMINVBINMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|