1.select col1,col2 from table1 where condition1=<<value1>>
UNION ALL
select col1,col2 from table2 condition1=<<value2>>;
2. `select col1 from table3;`
3. I need to write the 3rd query where i need the output of col1,col2 from table1 based on the col1 (sort based on col1 from table3).
に複数のクエリの出力を合成し、私は(MySQLで)単一のクエリにしたい、このようは1
create table as temp_table as
select col1,col2 from table1 where condition1=<<value1>>
UNION ALL
select col1,col2 from table2 condition1=<<value2>>;
SELECT t1.col1,t1.col2
FROM temp_table t1
LEFT OUTER JOIN table3 t2 ON t1.col2=t2.col2
order by t2.col1;
を行うことができます&は、一時テーブルを使用していません。
どのような考えですか?ありがとう。
すべてのサンプル例はありますか?ありがとう。 – Sharpeye500
(table2の条件1 = <>からCOL2 ALL 選択COL1をCOL1を選択し、TABLE1条件1 = <> UNIONからCOL2) LEFT OUTERはsub.col2 = T3 ON表3のT3をJOINサブ からの選択COL1、COL2 を選択します。 col2 t3.col1による注文; –
Jan