Combining AND and OR for complex expressions (SQL)
Thursday 01/8/2009 – Category: Uncategorized
This is a pretty basic concept, but for some reason I forgot the power of parentheses:
To select people with first name equal to "Jason" and last name equal to "Tom" or "Ting":
SELECT * FROM people WHERE
first_name='Jason'
AND (last_name='Tom' OR last_name='Ting')
Leave a Reply
Recent Posts
- LED Light for iPhone 4
(Monday 06/28/2010 – 38 Comments) - WWDC 2010: Worth Every Minute
(Monday 06/14/2010 – No Comments) - Flickr Original for Safari 5!
(Wednesday 06/9/2010 – 15 Comments) - iPad thoughts
(Friday 04/2/2010 – 1 Comment)
