Last active
April 14, 2016 10:28
-
-
Save kurozumi/ff8786fb9c9000d9014d9509c460dfb5 to your computer and use it in GitHub Desktop.
【MySQL】2つのテーブルを比較して重複していないデータを抽出してCSVファイルに保存する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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