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

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

    Simple WHERE problem


    To me, this sounds very basic, but looking at equality operators and NOT, I just can't make it work for me.

    Rows = everything from Some_Date except where the Name Column = 'X'.

    So:

    SELECT * FROM some_table WHERE date = 'some_date'

    gives me the whole thing for that date.

    How do I add a restrictive WHERE condition to this (that doesn't involve the date column)? I suppose I could do a sub-query, but that seems stupid.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    102
    Rep Power
    65
    The query will match row(s) that result in a TRUE value for the WHERE clause.

    Code:
    SELECT * FROM some_table WHERE date = 'some_date' AND name != 'X'
    If this doesn't do what you want, provide a more specific example of some data you want to the query to match and not match.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    218
    Rep Power
    17
    I swear I tried that because it's obvious... Must have had a typo in my sql... I'm a "nube"...

IMN logo majestic logo threadwatch logo seochat tools logo