1

partition by を使用して重複行を取得していますが、このクエリは mysql5.7 で構文エラーを返します。

select column1,ROW_NUMBER() OVER (PARTITION BY column2, column3 ORDER BY column2 DESC) as  RowNumber 
from tableA

エラー:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(PARTITION BY column1, column2 ' at line 1

または他のクエリ

または、重複する行のみを再実行する他のクエリ (列 2 と列 3 の両方に同じ値が含まれます) この場合、出力は行 1、3、5、6 を返します。

テーブル内のすべての行:テーブル内のすべての行

クエリによる望ましい出力:クエリによる目的の出力

ご協力いただきありがとうございます。

4

1 に答える 1

1

存在する場合:

select t.* from tablename t
where exists (
  select 1 from tablename
  where column1 <> t.column1 and column2 = t.column2 and column3 = t.column3
)
于 2020-04-08T10:19:00.790 に答える