我有兩個表(table_a和table_b)與一個UNION組合在一起。檢查記錄是否來自table_b
如何檢查記錄是否爲table_a。
我想這一點,但不工作:
$res=mysql_query("(SELECT id, added FROM table_a WHERE user_id = '".$uid."')
UNION
(SELECT id as comments, added FROM table_b WHERE user_id = '".$uid."') ORDER BY added DESC LIMIT 50");
if(!empty($rows["comments"])) // not working
我有同樣的問題...我認爲...:http://stackoverflow.com/questions/13598450/add-column-to-say-which-table-a-union-result-is-from –