Results 1 to 3 of 3
  1. #1
    cherold is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2014
    Posts
    82

    trying to filter out field with certain string but it also filters out empty strings!


    I am so confused. I have a query:
    Code:
    SELECT Songs.SongID, Songs.Title, Songs.Alternative
    FROM Songs
    WHERE (((Songs.Alternative)<>"UNIQUE"))
    ORDER BY Songs.Title;
    I was hoping that where clause would filter out rows where the Alternative field had "UNIQUE", but it also filters out all rows where Alternative has nothing.

    Example:
    Songs Table:
    Code:
    SongID Title         Alternative
    1          hello        UNIQUE
    2          goodbye      DELETE
    3          where        MASTER
    4          how     
    5          which
    Using that query I only get:
    Code:
    2          goodbye      DELETE
    3          where        MASTER
    Why? How should I be doing this so I get all rows except the one that has "UNIQUE" in it?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    WHERE Songs.Alternative <> "UNIQUE" OR Songs.Alternative Is Null
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Code:
    SELECT Songs.SongID, Songs.Title, Songs.Alternative
    FROM Songs
    WHERE (((Songs.Alternative)<>"UNIQUE")) or songs.alternative is null
    ORDER BY Songs.Title;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 03-16-2017, 12:19 PM
  2. Replies: 2
    Last Post: 02-20-2017, 11:28 PM
  3. Replies: 9
    Last Post: 02-24-2015, 11:19 AM
  4. Replies: 3
    Last Post: 07-26-2012, 03:09 PM
  5. Replies: 1
    Last Post: 07-14-2008, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums