WHERE Clause Question

  • Say you have a table like this:

    FirstName LastName Age Country

    Jimmy Jones 21 UK

    Sally Smith 23 UK

    Jimmy Woods 24 UK

    Freddy Woods 24 UK

    I'd like a query that returns all the records except the where the FirstName = "Jimmy" and the LastName = "Woods". That is, only when the FirstName is Jimmy AND the last name is Woods. Hence, the query would return 3 rows like this:

    Jimmy Jones 21 UK

    Sally Smith 23 UK

    Freddy Woods 24 UK

    Thanks

  • WHERE FirstName <> 'Jimmy' AND LastName <> 'Woods'

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • select * from Table where not (FirstName = 'Jimmy' and LastName = 'Woods')

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Thanks Ryan

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

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