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
- Marble Paint
(Friday 02/4/2011 – 1 Comment) - More Flickr Original Updates
(Sunday 01/23/2011 – 13 Comments) - Flickr Original updates
(Saturday 08/7/2010 – 19 Comments) - LED Light for iPhone 4
(Monday 06/28/2010 – 65 Comments)
