extract one of each record

G

Guest

Long-term, I hope to have this database redesigned, but that is not my
decision.
Anyway...
I have a list of people who attended classes. In the same table, the date
and time of the class is duplicated for each record. (This date and time
info does not exist elsewhere in the db.) I would like to extract each
unique combination of CName, Date, and Time.
I've only bee asked to do this once, and I took the query results into
Excel and used the Advanced Filter to get unique records only. What do I
need to do to accomplish this without going into Excel?

Thanks.
 
G

Guest

Hi, TJ.
used the Advanced Filter to get unique records only. What do I
need to do to accomplish this without going into Excel?

Use the DISTINCT keyword in your query. For example, create a new query and
open the SQL View pane to paste the following:

SELECT DISTINCT CName, Date, Time
FROM MyTable;

.. . . where MyTable is the name of the table. Since Date and Time are
Reserved words and should be changed to avoid hard-to-track bugs, while
you're fixing the database you'll want to address this issue, too.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.
 
G

Guest

Thanks! I'm about to play with it myself, but if you look back at this
thread, here's an additional question:
Can I return additional columns while only applying DISTINCT to the same
three fields?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top