Queries without duplicates

P

puppypaws

I'm working with a huge imported database from which I needa query with
employee id, last name, first name, benefit name employee cost and employer
cost. I keep getting duplicates on the ID and names. How can I get rid of
these so that the employee number is the key record?
 
A

adam.vogg

setup an empty table with the employee ID set as primary key. then
change your query into an append query and append into that table.
you will get a warning saying "cant append X number of records due to
primary key violation". those are your dupes not being entered. the
table will then have your records with no duplicates.
 
P

puppypaws

I'm not very experienced with this. I've tried "first" and " no duplicates"
but it takes away everything. Do I just type "distinct" in the criteria box?
 
C

Christopher Robin

Please, do not duplicate your data.

As a previous poster suggested (but left the details out), use a SELECT
DISTINCT. From the Query window, select the SQL View, and type a SQL
Statement like:

SELECT DISTINCT Col1, Col2, Col3.....
FROM myTable

Or from the GUI, add the columns to your query and then select the Totals
button. Just ensure that each column has a Group By in the Totals row (this
is the default).
 

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