我有兩張表 table1,table2,
table1:
id qty tag
1 10 1
2 12 1
-----------------------
table2:
id qty tag
1 13 2
-----------------------
兩張表是通過id 聯繫起來,現查詢後一張新表table3,要求如:
table3
id qty tag
1 10 1
1 13 2
2 12 2
-----------------------------
請高手幫我寫出相應sql語句
table1:
id qty tag
1 10 1
2 12 1
-----------------------
table2:
id qty tag
1 13 2
-----------------------
兩張表是通過id 聯繫起來,現查詢後一張新表table3,要求如:
table3
id qty tag
1 10 1
1 13 2
2 12 2
-----------------------------
請高手幫我寫出相應sql語句
union all select id,qty,tag from table2
order by id