Results 1 to 3 of 3

Thread: OR/IN Clause

  1. #1
    Join Date
    Jun 2002
    Posts
    3

    Unanswered: OR/IN Clause

    What is the best way to use OR Clause Performance wise.
    Is IN clause anyway better than OR in any case.

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    From BOL...

    A. Compare OR and IN
    This example selects a list of the names and states of all authors who live in California, Indiana, or Maryland.

    USE pubs

    SELECT au_lname, state
    FROM authors
    WHERE state = 'CA' OR state = 'IN' OR state = 'MD'

    However, you get the same results using IN:

    USE pubs

    SELECT au_lname, state
    FROM authors
    WHERE state IN ('CA', 'IN', 'MD')



    performance wise they are equal.
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    May 2002
    Location
    Timbaktu
    Posts
    185

    Talking They are same

    They are same

Posting Permissions

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