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

How to have Query Show only one of each Duplicate entry?

Status
Not open for further replies.

ksgirl2

Programmer
Jul 19, 2002
45
US
Hello,

This is pretty simple. I forgot how to do this. How do I create a list of only One copy of each duplicate item in a query. for example - last names. I want a query to show me all the lastnames of people in my database but if there are 26 smiths i only want the "smith" to show up once in the query's list. Is there a sort command for this to put in the critera box for this??

Thanks in advance :)

m
 
"SELECT DISTINCT" will give you distinct results based on 1 field (if I remember correctly)

"SELECT DISTINCTROW" will give you each unique row, so Smith would show up 10 times, but John Smith would only show up once, no matter how many John Smith's you have...

take a look at these and you'll get your exact answer. Kyle
 
Thanks Kyle.

DISTINCT! i couldn't remember that word! but i also found that if you use the GROUPBY selection inside the query has the same effect.
Thanks
 
It ends up having the same effect as long and the rest of the fields in the query (if there are any) are performing a function and not also on "group by". For a single field query, I guess they would be interchangeable, but be careful, as assuming group by will limit your results will get you some wierd info in any other query...

Best,
Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top