Results 1 to 3 of 3
  1. #1
    jonesin1974 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    2

    Need help with SQL query

    Hi all,



    I've got an issue with my SQL query. The main issue is that I'm not sure what I'm asking.

    I envision my query to work as such:

    select * from MyTable where PrimayField = 'PrimaryValue' and SecondaryField = ('Val1', 'Val2', 'Val3')

    I want the results to have all rows containing 'PrimaryValue' and the SecondaryField having 'Val1' or 'Val2' or 'Val3' as its field value.

    Many thanks!
    J

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Try
    select * from MyTable where PrimayField = 'PrimaryValue' and SecondaryField IN ('Val1', 'Val2', 'Val3')

  3. #3
    jonesin1974 is offline Novice
    Windows 10 Access 2007
    Join Date
    Feb 2017
    Posts
    2
    Top man! Worked a treat. Thank you

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