Results 1 to 4 of 4
  1. #1
    baileywerner is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2020
    Posts
    1

    Can't remove duplicate from union query

    Hi!



    I've created a union query which pulls data from seven tables. The resulting query contains four fields: StreetNumber, StreetName, Longitude, and Latitude.

    For some reason, one of the records in the union query is duplicated and I cannot for the life of me figure out why. Two of the seven tables contain this address, but the address is completely identical in both tables.

    We've narrowed down the issue to the latitude field-- if this field is excluded, the duplication disappears. However, the latitude for this address in both tables appear to be completely identical. Even copying the latitude from one table to the other does not solve the problem. Replacing the latitude with 99999 in both tables also does not solve the problem (we are then left with two 99999 records in the union query).

    Here's the relevant piece of the union query code, if that helps (it's extremely straightforward, so I don't imagine this is the problem):

    SELECT table1.Validated_StreetNumber, table1.Validated_StreetName, table1.Longitude, table1.Latitude
    FROM table1


    UNION

    SELECT table2.Validated_StreetNumber, table2.Validated_StreetName, table2.Longitude, table2.Latitude
    FROM table2;



    Has anyone run into an issue like this before? Or have any ideas how to solve it? We've really tried anything we can think of.

    Thank you!

  2. #2
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It would help if you would post the dB with 10 records in each table to illustrate the problem.


    And welcome to the forum......

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,829
    Don't know how you copied from one to another, but make sure you don't have a multi-line record in one table.
    I might create a query with both tables, equal join the latitude fields and put the criteria in against one of those fields. If they are not exactly equal, you'll get nothing when you run the query. Could be a hidden character too.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    Check that the latitude fields are the same number datatype. If one is single and the other double then the precision will differ and the stored numbers may not be identical.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to remove duplicate frpm query
    By dinesh010595 in forum Access
    Replies: 1
    Last Post: 06-18-2019, 04:32 PM
  2. Replies: 25
    Last Post: 01-27-2017, 11:55 AM
  3. Replies: 2
    Last Post: 10-16-2015, 10:15 PM
  4. Remove Duplicate Entries in Query Design
    By samanthaM in forum Access
    Replies: 1
    Last Post: 10-27-2013, 11:26 AM
  5. Suming Duplicate Records in Union Query
    By Sqnwk in forum Access
    Replies: 1
    Last Post: 10-30-2012, 06:10 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums