SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: How to search for several different values in a "Field"?

  1. #1
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to search for several different values in a "Field"?

    How would I search for say
    2
    3
    4
    5
    6

    in a field?
    I tried comma seperating them but that didnt work. Im used to using the search function in phpmyadmin but have never needed to search for multiple things before.
    Perhaps Id have to do a "query"?

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,456
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)
    Code:
    SELECT something
      FROM sometable
     WHERE somecolumn IN ( 2,3,4,5,6 )
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thanks worked fine.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •