Results 1 to 4 of 4
  1. #1
    accesssri is offline Novice
    Windows XP Access 2000
    Join Date
    Dec 2011
    Posts
    2

    need help in query

    Hi,
    I am not sure how i should write the query to fetch one record. below is how the data in my table. rows 1 and 2 have the same value and value in ID1 is value of ID in second row.


    The query needs to fetch one row per value.
    Appreciate if you anyone help me with the query in access.

    ID Value ID1
    11 100 21
    21 100 11
    31 200 41
    41 200 31

    thanks,

  2. #2
    dblife's Avatar
    dblife is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    Create a select query with one of the Id's as the criteria. You will only get one record returned.

  3. #3
    accesssri is offline Novice
    Windows XP Access 2000
    Join Date
    Dec 2011
    Posts
    2
    I donot know the Id to pass to the query. I have to work on the whole set and get one record from the pair.

  4. #4
    fcp is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2011
    Posts
    8
    Try using Union Query for example if your data looks like

    ID, Value, ID1
    11 100 21
    And you want it to look like

    ID, Value
    1I 100
    2I 100

    You have to use UNION QUERY.
    Example:

    SELECT Value,
    [ID] AS ID,
    [ID1] AS ID
    UNION ALL
    From Table;

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

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