postgresqlのexceptで勘違いしてた件
久々2連投。
こないだバッチ処理の結果確認するのにexcept使ってたんですけど、
これ重複すると丸められちゃうんですね。勘違いしてた*1
select * from table1; col1 ------- A A B D select * from table2; col1 ------- B C select * from ( select * from table1 except select * from table2 ) as v1; col1 ------- A D
重複させたくないときは「except all」使えばいい。
select * from ( select * from table1 except all select * from table2 ) as v1; col1 ------- A A D
*1:minusも一緒