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 |
|
Goalie35
Yak Posting Veteran
81 Posts |
Posted - 2008-12-03 : 11:34:43
|
| Ok, I should know this but right now the answer is slipping my mind...if I have 2 tables(tableA & tableB), how do I grab all values from tableA that are NOT located in tableB?Ex:TableA--------OrangeAppleBananaGrapeTableB--------Apple BananaSo, in this example, I'll display the two values from tableA that aren't in tableB: "Orange" & "Grape".Thanks.-Goalie35 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-03 : 11:39:05
|
| [code]SELECT field FROM TableAEXCEPTSELECT field FROM TableB[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-03 : 11:40:55
|
AlsoSELECT a.fieldFROM TableA aLEFT JOIN TableB bON b.field=a.fieldWHERE b.field IS NULL &SELECT *FROM TableA aWHERE NOT EXISTS (SELECT 1 FROM TableB WHERE field=a.field) |
 |
|
|
|
|
|