hakeの日記

Windows環境でプログラミングの勉強をしています。

SQLite - 重複の除去(DISTINCT)

指定したカラムで重複ているものを除去して出力する

sqlite> select * from AAA;
tt          ii          rr
----------  ----------  ----------
aaa         1           1.0
aaa         1           2.0
aaa         2           3.0
aaa         2           4.0

sqlite> select distinct tt from AAA;
tt
----------
aaa

sqlite> select distinct tt,ii from AAA;
tt          ii
----------  ----------
aaa         1
aaa         2

sqlite> select distinct tt,ii,rr from AAA;
tt          ii          rr
----------  ----------  ----------
aaa         1           1.0
aaa         1           2.0
aaa         2           3.0
aaa         2           4.0