ROW_NUMBER() OVER (PARTITION BY 在 mysql5.7 中给出语法错误
ROW_NUMBER() OVER (PARTITION BY giving Syntax error in mysql5.7
我正在使用分区依据来获取重复行并且此查询 returning 语法错误 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
或任何其他查询
或任何其他查询只返回重复的行(column2 和 column 3 repectivley 包含相同的值)在这种情况下输出将 return 第 1、3、5、6 行
table 中的所有行:
查询所需的输出:
感谢您的帮助。
有 EXISTS:
select t.* from tablename t
where exists (
select 1 from tablename
where column1 <> t.column1 and column2 = t.column2 and column3 = t.column3
)
我正在使用分区依据来获取重复行并且此查询 returning 语法错误 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
或任何其他查询
或任何其他查询只返回重复的行(column2 和 column 3 repectivley 包含相同的值)在这种情况下输出将 return 第 1、3、5、6 行
table 中的所有行:
查询所需的输出:
感谢您的帮助。
有 EXISTS:
select t.* from tablename t
where exists (
select 1 from tablename
where column1 <> t.column1 and column2 = t.column2 and column3 = t.column3
)