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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Join or Union or Something Else? 1

Status
Not open for further replies.

gall3on

Technical User
Mar 15, 2007
35
US
Need help figuring out which SQL will work...

I have the following SQL code:

SELECT NPP2.PID AS Others,

Sum(NPP2.Total) AS Total,
Sum(NPP2.AP) AS AP,
Sum(NPP2.EN) AS EN,
Sum(NPP2.CN) AS CN,
Sum(NPP2.TD) AS TD

FROM GroupedPartners, NPP2

WHERE ((NPP2.PID) In (GroupedPartners.[Grouped Partners]))

GROUP BY NPP2.PID;

This query works fine. But now I need a query that will pull records from NPP2 with a PID that is not matching anything on GroupedPartners.

I've tried:
WHERE ((NPP2.PID) NOT In (GroupedPartners.[Grouped Partners]))

but the result shows me all the records and doesn't exclude the PIDs which matched up GroupedPartners.

Thanks for any help!
 



Hi,
Code:
FROM NPP2

WHERE PID Not In (Select [Grouped Partners] From GroupedPartners)

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top