I have a table where some records may be duplicates.
Table: dashboard.scrappy.imoveis | data | imobiliaria | negocio | codigo | cidade | uf | tipo | bairro | url | endpoint | total | valor | | --------- | ----------- | ------- | ------ | ------ | ------ | ------ | ------ | ------ | -------- | ----- | ----- | | timestamp | string | string | string | string | string | string | string | string | string | float | float |
复制记录在4栏(/data
,imobiliaria
,negocio
,codigo
)中标明。
表中没有中值指数(增值)栏。
我试图使用以下指示:(删除留下1个记录的重复)
DELETE FROM `dashboard.scrappy.imoveis`
WHERE ((ROW_NUMBER() OVER (PARTITION BY `data`, `imobiliaria`, `negocio`, `codigo`) > 1) AND (COUNT(*) > 1 OR (COUNT(*) = 1 AND ROW_NUMBER() OVER (PARTITION BY `data`, `imobiliaria`, `negocio`, `codigo`) = 1)))
GROUP BY `data`, `imobiliaria`, `negocio`, `codigo`;
But it is giving the error: Syntax error:
Syntax error: Expected end of input but got keyword GROUP at [3:1]
关于如何确定建议的任何建议?