我有 3 个表共享完全相同的结构,例如:
id name_col
我有这个查询:
$query = mysql_query("SELECT * FROM tbl_1 UNION SELECT * FROM tbl_2 UNION SELECT * FROM tbl_3");
现在:
while($row = mysql_fetch_array($query)){
names .= $row['name_col'];
// HERE HOW I COULD KNOW WHICH TABLE THIS DATA IS COMING FROM?
// THIS NAME IS FROM tbl_1 OR tbl_2 OR tbl_3
}