'Where Clause' help

Discussion in 'MySQL' started by videospud, Oct 23, 2006.

  1. #1
    I have a MySql database that logs all referring domains. When I display the domains, I need to filter out some, so I use:
    SELECT * FROM [I]table[/I] WHERE [I]field[/I] != 'domain1.com'
    Code (markup):
    which works fine. But I need to filter out multiple domains. I try to use:
    SELECT * FROM [I]table[/I] WHERE [I]field[/I] != 'domain1.com, domain2.com'
    Code (markup):
    which doesn't work. Is there a way to do this with a query statement or do I need to filter out using php after the statement?

    Thanks,
    Drew
     
    videospud, Oct 23, 2006 IP
  2. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT * FROM table WHERE field != 'domain1.com' AND field != 'domain2.com'

    :)
     
    disgust, Oct 23, 2006 IP
  3. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #3

    or..

    SELECT * FROM table WHERE field NOT IN ('domain1.com', 'domain2.com')
     
    SoKickIt, Oct 23, 2006 IP
    disgust likes this.
  4. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #4
    I don't know if I'm wrong but, I have found that many problems with MySql arise from the use of the recent phpMyAdmin.

    Yeah, I know they have nothing to do, but since thy began with their "cosmetic changes" and useless language charsets and other stuff that is everything worst, and worst :rolleyes:
     
    Mystique, Oct 23, 2006 IP