Wednesday, March 28, 2012

subtracting queries

I have 2 sql queries, and want to subtract one from the other, if that makes sense, i'm not too sure of the correct terminology.

The results of both queries have a common field, PlayerId.

query1 (select PlayerId, FirstName, LastName from Table1 where ....)

query2 (select PlayerId from Table2 where ....)

Thanks

RamilaYou could do a negation on an IN or Exists query for example:

Select PlayerID, FirstName, etc... FROM Table1 WHERE PlayerID Not IN(Select PlayerID from Table2...)

0 comments:

Post a Comment