Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在一个请求中查询两个 similair mysql 表,将不匹配的列设置为默认值,如 NULL?
table1 col1 col2 col3 A B C table2 col1 col2 col4 D E F
结果应该是:
table col1 col2 col3 col4 A B C NULL D E NULL F
是的,很有可能:
SELECT col1, col2, col3, NULL as col4 FROM table1 UNION ALL SELECT col1, col2, NULL, col4 FROM table2
SQL 小提琴。