Results 1 to 2 of 2
  1. #1
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25

    SQL Query

    Hi,

    I am trying to retrieve some records via a Union SQL Query. Problem is that the area field shows as ID numbers not the actual values which are in the next column of area table. Normal queries run as normal (Shows area values instead of IDs)

    When I setup the query it shows the names but in the SQL Query it shows ID numbers of the same fields.



    Any suggestions how to show texts instead of ID's?

    This area table has two fields ID; Area.

    SELECT [Audit Register Query 1-44].[Audit Number], [Audit Register Query 1-44].[CEP No], [Audit Register Query 1-44].[CEP Name], [Audit Register Query 1-44].[Audit Date], [Audit Register Query 1-44].Percent, [Audit Register Query 1-44].[Month Date], [Audit Register Query 1-44].[Area], [Audit Register Query 1-44].[CEP Final Status]
    FROM [Audit Register Query 1-44]


    UNION ALL
    SELECT [Audit Register Query 45-117].[Audit Number], [Audit Register Query 45-117].[CEP No], [Audit Register Query 45-117].[CEP Name], [Audit Register Query 45-117].[Audit Date], [Audit Register Query 45-117].Percent, [Audit Register Query 45-117].[Month Date], [Audit Register Query 45-117].[Area], [Audit Register Query 45-117].[CEP Final Status]
    FROM [Audit Register Query 45-117]


    UNION ALL SELECT [Audit Register Query 118 Onwards].[Audit Number], [Audit Register Query 118 Onwards].[CEP No], [Audit Register Query 118 Onwards].[CEP Name], [Audit Register Query 118 Onwards].[Audit Date], [Audit Register Query 118 Onwards].Percent, [Audit Register Query 118 Onwards].[Month Date], [Audit Register Query 118 Onwards].[Area], [Audit Register Query 118 Onwards].[CEP Final Status]
    FROM [Audit Register Query 118 Onwards];




    Regards

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Have to join tables. Options:

    1. Join Area table to each of the other tables in each SELECT line of UNION query.

    2. Join the UNION query to the Area table
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

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