我有severals表,命名爲這樣的:如何合併MySQL中多選擇
table_2012_12
table_2012_10
table_2012_07
都具有相同的結構:
id
order_id
account_id
我知道我必須執行這些查詢:
SELECT * FROM table_2012_12 where id=1
SELECT * FROM table_2012_12 where id=5
SELECT * FROM table_2012_10 where id=1
SELECT * FROM table_2012_07 where id=22
什麼是最好的(在表演)方法使用單個查詢?
在您採用下面的聯合查詢之一後,使用它們構造一個名爲'all_time_table'的新表,並在其中包含日期字段。 :) –