Select Distinct Records

  • Thread starter Thread starter Les Coover
  • Start date Start date
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
 
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
 
Just those two fields?

SELECT DISTINCT FirstName, LastName
FROM TableName

Or do you mean something else?
 
Back
Top