Select Distinct Records


L

Les Coover

I have information listed in a MS Access Database
(Office NT) in fields FirstName and LastName there
are many duplicates. And of course there are records
like Smith, Adam and Smith, Mary.

Could someone explain how to write an SQL query
that will extract all unique FirstName, LastName
(DISTINCT records) but not give me repetitions.

I want all the records but things like
Smith, Adam and Smith, Mary should be included.


Thanks, Les Coover
 
Ad

Advertisements

T

Tonín

Try this one:

SELECT DISTINCT *
FROM YourTable;

and compare results with this:

SELECT *
FROM YourTable;

First query doesn't allow duplicates. If you want to establish the DISTINCT
predicate from the design view: Right click on a free area, choose
Properties and change "Unique values" to "Yes".


Tonín
 
Ad

Advertisements

J

John Spencer (MVP)

Just those two fields?

SELECT DISTINCT FirstName, LastName
FROM TableName

Or do you mean something else?
 

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