faqts : Computers : Databases : Microsoft Access

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

25 of 57 people (44%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

remove duplicates in a query but not delete from table

Dec 14th, 2005 11:07
Graham Smith, jane potts,


within Access SQL the COMMAND DISTINCT tells the database to only select
the rows in any query that are differnt to each other.

(I.e if the query would return the result 

Line 1 = 'Test'
Line 2 = 'Test'
Line 3 = 'Another Test'

the use of the DISTINCT Keyword means that only 

Line 1 = 'Test'
Line 2 = 'Another Test'

is returned.

This is most easily applied in Access by 

1) Right Clicking on A Query in Design View and setting the value the
Unique Values property to Yes

or 

2) Opening the  Query in the SQL editor and entering the word DISTINCT
after the word SELECT

(i.e. SELECT DISTINCT column FROM table;)