Query:
(SELECT * FROM q_and_a_questions WHERE question LIKE '%$words%') UNION (SELECT * FROM q_and_a_answers WHERE answer LIKE '%$words%') ORDER BY date DESC;
Basically, I need to search the field question for keywords in one table and the field answer for keywords in another table, all in one query so it returns as one resultset.
However I get this error from PHP:
1064: You have an error in your SQL syntax near '(SELECT * FROM q_and_a_questions WHERE question LIKE '%hair%') UNION (SELECT * F' at line 1
I'm really confused because the query is built off what the mySQL manual says about using UNION. 🙁