I need a proper way to write a simple WHERE, AND, OR statement. This one doesn’t work:
SELECT `content`
FROM `bx_wall_events`
WHERE `type` = 'wall_common_text'
OR `type` = 'wall_common_fb'
OR `type`= 'wall_common_tw'
AND `owner_id`='{$iId}'
ORDER BY `date` DESC
LIMIT 1
It’s a valid statement, but I imagine the issue is the ORs aren’t being interpreted like you’d expect. Use the IN syntax instead:
I removed the backticks in certain spots because they’re only necessary for escaping table & column names that are using MySQL reserved keywords.
The way this:
…is evaluating is: