SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: WHERE help

  1. #1
    SitePoint Guru SharifTK's Avatar
    Join Date
    Jan 2004
    Location
    New York, NY
    Posts
    621
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WHERE help

    How would I go on about doing a query where a field equals either 1 or 3?

    SELECT fields FROM table WHERE field = '1' OR... does not work.
    SK

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2001
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have working querys on my site that look like this :

    WHERE ( field = '1' OR field ='3' )

    afaik it should work without the ( ) too, so your example *should* work according to me.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    where field in (1,3)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •