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

Only 1 instance in a field

Status
Not open for further replies.
Jul 27, 2004
52
0
0
US
I have a query that i need to group by transaction #, and then I have another field which identifies a code for the type of transaction. example: field 1 = Transaction # and field 2 = transaction type which can be either 01, 02 or 03.
So, i want to group by trans # and ONLY see those instances where only ONE transaction type has been chosen.
Help
 
Can you please post some input samples and expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Can you have multiple records with the same transaction type for one transaction # ( can there be 2 type 01 for transaction number 1)
 
you need to add a HAVING clause to the end of your query

HAVING Count(Transtype) = 1

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
okay, the transaction # is the primary so...

Trans #1 can have 01, 02 or 03 in any combination. It will not be null.

I want to know which transaction #'s have only ONE instance of 01, 02 or 03.

Hope this helps. It's Friday, I'm slammed and working on three different databases this morning.
Thanks for everything :)
 
ok, now I'm confused. If Trans# is the PK and the Trans# = 1 (so there is ONE record with Trans# 1). How is Trans#1 going to have more than one transType?

Could you do as PHV asked and post sample data and maybe even the SQL you are currently using?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top