how to remove specific values from my query critera

  • For example, lets say I want to query a bowl of fruit but I don't want results that have apple, oranges, pears. Lets say there's 100 types of fruit. How do I tell ms access to ignore apple, oranges and pears in my search? Im using the design view in access.

    Thank you

  • This is not a MS Access forum and a database is not a bowl of fruit, but here is how you exclude specific rows from a SQL query.

    select Fruit

    from Bowl

    where Fruit not in ('apple','orange','pear');

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • There are a couple of ways to exclude specific records from your query results. The most common is: Not Like "apples" and Not Like "oranges" and Not Like "pears"However that gets pretty ugly if you have 5 or 10 records you want to exclude. The other option is:Not In("apples","oranges","Pears")Be aware that the syntax in SQL Server T-SQL is somewhat different. Also, the quote characters are necessary for text fields but not for numeric values.

    Wendell
    Colorful Colorado
    You can't see the view if you don't climb the mountain!

  • Thanks for info

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply