Results 1 to 3 of 3

Thread: <> when it applies to two or more columns

  1. #1
    Join Date
    Nov 2005
    Location
    Seattle
    Posts
    5

    <> when it applies to two or more columns

    My question is how do I properly enter the information. I'm working on an exercise for class and I can get one item to be deleted from the list. I enter the following information:

    select,customerid,item from item_ordered where item <> 'Tent';

    I want to make the string remove the catagory, 'Umbrella' along with the catagory named 'tent'. I have learned how to remove one item from a column, but how do you apply this technique to two or more items as well.

    I have tried a variety of different configurations using the <> path and have not tried any others. Am I logically thinking this through?

    -Ron

  2. #2
    Join Date
    Oct 2005
    Posts
    2,557
    Add another condition. You can add an AND or an OR, depending on what it is you want to filter out. One way then would be to use where item <> 'Tent' or item <> 'Umbrella.'

    Yet another (more efficient way) is to use a list. The query would be:

    select customerid, item
    from item_ordered
    where item not in ('Tent', 'Umbrella');

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    Try this if you are using sql server:

    select customerid, item from item_ordered
    where item not in ('Tent', 'Umbrella')

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •