Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate records

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a simple Report that uses a simple query. Everything works fine if all of the records are unique and will come out like:

Field1 10
Field2 5

But if there is a duplicate entry say for "Field2" it comes out like this:

Field1 10
Field2 4
Field2 1

Im not sure why this happens or how to fix it...can someone please help!

Thanks!!

Paul
 
eh, what's wrong with that?

if you're not supposed to have duplicates, then why are there duplicates in the data?

how exactly do you want to show it? in your example, would you want to show 4 or 1 for field2, or a sum of the 2...

you might want to have a look at the DISTINCT keyword

--------------------
Procrastinate Now!
 
I would like to have it show a total for field2, so it should show:

Field2 5

I will look at the DISTINK keyword, but i guess im not understanding why it is creating an additional FIELD2.....

Thanks!!!

Paul
 
if you want the sum, then you need to group the data on your Field field, and then display the sum of the group...

e.g.

select field, sum(value) from tblName group by field

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top