Hi this is what I want to do:
to_id: 5 to_type: 1
from_id: 3 from_type: 2
I want to SELECT ALL WHERE to_id
= 5 only if to_type
= 1 AND I want to select * where from_id
= 3 only if from_type
= 2.
how can I do this in a single SELECT statement?
Looks like this is what you want
SELECT * FROM foobar WHERE (to_id = 5 AND to_type = 1) OR (from_id = 3 and from_type = 2)
That is, get all rows that either matches to_id = 5 and to_type = 1, or matches from_id = 3 and from_type = 2.