#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    218
    Rep Power
    17

    Figuring out the WHERE clause...


    How come when I run this query:


    SELECT *
    FROM SomeTable
    WHERE ColA = 'SomeValue'
    AND ColB = null AND ColC = null

    returns no rows when I know there are some?
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,436
    Rep Power
    9645
    Comparing anything to NULL will give you NULL. And no, NULL=NULL is not true.

    Use IS NULL.

IMN logo majestic logo threadwatch logo seochat tools logo