我有一个查询:
(SELECT col1 AS table1 FROM table1 WHERE col3 IS NOT NULL)
UNION ALL
(SELECT col1 AS table2 FROM table2 WHERE col3 IS NOT NULL)
UNION ALL
(SELECT col1 AS table3 FROM table3 WHERE col3 IS NOT NULL)
但是,当我使用 PDO 和fetchAll(PDO::FETCH_ASSOC);
命令处理它时,生成的数组的键都以 table1 的形式出现,而不管它们实际来自哪个表。
我的语法不正确吗?谢谢!