Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Unanswered: multiple WHERE statements in a query...

    what is the syntax to have more than one WHERE statement in a MySQL query?

    just...cant...figure...it...out....
    thanks ^_^

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you can have only one WHERE clause, but it can contain multiple conditions evaluated using ANDs, ORs, and parentheses

    for example,

    where foo = 'bar'
    and ( datesent = now() or active = 0 )

    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Dec 2002
    Posts
    17
    Could I contsruct my query like below?

    WHERE userid='$userid' OR username='$username'

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i don't see why not

Posting Permissions

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