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

query capture 1 duplicate 1

Status
Not open for further replies.

l3reacher

Technical User
Jun 28, 2003
83
US
I have a query I have fields: ID, Name, and Track. What I wan to do is capture all of the information, except for the duplicates. What I mean is that if I have two ID's called 4, I want one of the 4 to show up, but the other 4 doesn't.
This query will be coming out from a table called Department. I'll give an example

In table Department
ID NAME TRACK
1 Dave Acct
2 Emily Clerk
2 Emily Clerk
3 Daniel Manager
4 Joe Manager
4 Joe Manager
4 Joe Manager
5 Stacy Sr. Clerk

The one I have below is what I have for the query, but i don't want this.
ID NAME TRACK
1 Dave Acct
2 Emily Clerk
2 Emily Clerk
3 Daniel Manager
4 Joe Manager
4 Joe Manager
4 Joe Manager
5 Stacy Sr. Clerk


In query, I want it to look like the one below
ID NAME TRACK
1 Dave Acct
2 Emily Clerk
3 Daniel Manager
4 Joe Manager
5 Stacy Sr. Clerk



I Hate Spammers and Flammers!!!
 
I forgot to add in. I need the duplicates in the table and that's y I did not delete these duplicates.

I Hate Spammers and Flammers!!!
 
Use this SQL in a new query:

Code:
Select A.[ID], A.[Name], A.[Track]
FROM Department as A 
GROUP BY A.[ID], A.[Name], A.[Track]
ORDER BY A.[ID];

This will group by all of your fields giving you a recordset with one instance of the records that are exactly the same in all three fields.

Post back if you have any questions.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Thanks alot, it works great!!!

I Hate Spammers and Flammers!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top