Removing duplicates after running a union query (for address labels)

stevieg123

New member
Local time
Today, 06:12
Joined
Mar 31, 2011
Messages
5
I've got a nice little database that uses a union query to give me a sheet of address labels, sometimes people buy more than one thing and at the moment I'm wasting paper printing off multiple address labels that are the same.

I don't want to mess around with the base data as I use that for some other things. I've spent ages on google trying to find a way to get the duplicate records off the labels sheet but I either lack the vocabulary to ask google for the correct info or lack the knowledge of SQL to understand other peoples fixes for this.

Can anyone help?
 
are you using UNION ALL?? does a union query naturally suppress duplicate records anyway??
 
I probably should have mentioned that I've got the union query in there as a way of extracting the most recent set of data from the whole database. It unifies the remainder of the day (i.e. everything since the last set of labels was printed) with whole days (since the last labels were printed).

Its not the most elegant way to do things but it works, if anyone has any better ideas on how to filter just the most recent data (that would help with the labels problem) please let me know

thanks
 
Hi, yes, I'm using UNION ALL, I removed the " ALL" and it didn't seem to make much difference.
I should have mentioned that any rows that have the duplicate addresses will have unique values in other fields
 
I just took out everything from the union query that had different values (basically everything except the addresses) to see how it would deal with a data set that had identical entries and it was still showing multiple adresses
 
UNION is supposed to supress duplicates if the ALL keyword is not included.

Small differences (such as two spaces instead of one) in long text strings can look very similar.
 
Yup, that was it, when I removed all the columns that had unique data in them to leave the address only I forgot to take out the "ALL" from the SQL.

Thanks to Galaxiom and the_net_2.0 I really appreciate your help with this one. A minute conversation with you had a better effect than 3 hours of trawling google results

:)
 

Users who are viewing this thread

Back
Top Bottom