0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SQLで重複除去の重複条件に複数カラムを使用する際

Last updated at Posted at 2019-03-07

結構色々情報があって迷ってしまうんだけど、以下が一番楽コスパ良いと思う。

条件に使うカラムを文字結合して擬似的に1カラムと見なして、その擬似カラムにDISTINCTをかける。

SELECT DISTINCT column1 || ',' || column2, column3, column4
FROM table1;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?