Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active April 14, 2016 10:28
Embed
What would you like to do?
【MySQL】2つのテーブルを比較して重複していないデータを抽出してCSVファイルに保存する方法
SELECT
tbl1.item
FROM
tbl1
WHERE
NOT EXISTS (
SELECT
tbl2.item
FROM
tbl2
WHERE
tbl2.item = tbl1.item
)
INTO OUTFILE '/tmp/item.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment