Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

records returned by one query and not another

Status
Not open for further replies.

fegdvbna22

Programmer
Aug 9, 2006
52
GB
How do I write some SQL which gives the result set for the records that are returned by one query and not returned by another query?

Here are my 2 queries :

1)select distinct ups.SerialNumber,
ups.Division,
ups.Family,
ups.Product,
ups.ContractStart,
ups.SAPContractNumber,
ups.ContractType,
ups.AccountNumber,
ups.Territory
from UploadDataStaging ups

2) select distinct ups.SerialNumber,
com.CompanySiteKey,
ups.Division,
ups.Family,
ups.Product,
ups.ContractStart,
ups.SAPContractNumber,
ups.ContractType,
ups.AccountNumber,
ups.Territory
from UploadDataStaging ups inner join CompanySite com on
ups.CustomerName = com.[Name]
where com.[name] = ups.CustomerName and com.Address1 = ups.Street1 and com.Address2 = ups.Street2
 
BTW, it is the second query that is returning the additional records.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top