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

SQL - Pull accts that contain only 1 occurrance of a record type

Status
Not open for further replies.

colezpapa

Programmer
Feb 26, 2007
86
US
I have a table that contains a type field and an NAME_ID field. The NAME_ID can contain 1 to many different types.
It could be type MM, A LM, G .....
I am looking to get a list of only those NAME_ID's that contain only 1 type and that type is equal to "A".

How could I construct that in a query.
 
SELECT NAME_ID
FROM yourTable
GROUP BY NAME_ID
HAVING Count(*) = 1 AND Min(Type) = 'A'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top