SQL (this AND that), OR (that AND theOther)

Roger Eller roger.e.eller at sealedair.com
Tue Oct 8 16:52:00 EDT 2013


 Having some SQL query troubles...  I need to get results from a long list
in a single query, BUT there are pairs of fields that must match.  Every
pair is a unique pair, aka no duplicates.  If my list contains 50 pair that
are unique, I may only get 30 returned rows, but I need all 50.

This is what I've tried, but SQL strips away my outer parens, making my AND
less binding for the pair.

WHERE
      ((user = 'Joe') AND (car = 'Ford')) OR
      ((user = 'John') AND (car = 'Chevy')) OR
      ((user = 'Jim') AND (car = 'Kia')) OR
      ((user = 'Jim') AND (car = 'Smart'))

~Roger



More information about the use-livecode mailing list