Forum Moderators: open
$query
="(SELECT id, col2, col3 FROM table1 WHERE user_id = $_SESSION[user_id])
UNION ALL
(SELECT id, col2, col3 FROM table2 WHERE user_id = $_SESSION[user_id])
UNION ALL
(SELECT id, col2, col3 FROM table3 WHERE user_id = $_SESSION[user_id])";
The problem is that I need to be able to identify which table each result originated from.
The only way I can figure out is to do it as 3 separate queries and then add a 4th column to the query result array with the name of the table in it and then later merge that array with the other two.
Seems too messy and I'm sure some of you clever guys have got a much better way!
I hope you can help me. Thanks in advance.
peter