gpt4 book ai didi

sql - 替换 clickhouse 中的 row_number()

转载 作者:行者123 更新时间:2023-12-04 12:13:34 28 4
gpt4 key购买 nike

clickhouse数据库不支持Row_number(),寻找替代函数。

SELECT company_name AS company,
DOMAIN,
city_name AS city,
state_province_code AS state,
country_code AS country,
location_revenue AS revenueRange,
location_TI_industry AS industry,
location_employeecount_range AS employeeSize,
topic,
location_duns AS duns,
rank AS intensityRank,
dnb_status_code AS locationStatus,
rank_delta AS intensityRankDelta,
company_id,
ROW_NUMBER() OVER (PARTITION BY DOMAIN) AS rowNumberFROM company_intent c
WHERE c.rank > 0
AND c.rank <= 10
AND c.signal_count > 0
AND c.topic IN ('Cloud Computing')
AND c.country_code = 'US'
AND c.rank IN (7, 8, 9, 10)
GROUP BY c.location_duns,
company_name,
DOMAIN,
city_name,
state_province_code,
country_code,
location_revenue,
location_TI_industry,
location_employeecount_range,
topic,
rank,
dnb_status_code,
rank_delta,
company_id
ORDER BY intensityRank DESC
LIMIT 15 SELECT COUNT (DISTINCT c.company_id) AS COUNT
FROM company_intent c
WHERE c.rank > 0
AND c.rank <= 10
AND c.signal_count > 0
AND c.topic IN ('Cloud Computing')
AND c.country_code = 'US'
AND c.rank IN (7, 8, 9, 10)

执行上述查询时出现以下错误。

预期之一:SETTINGS、FORMAT、WITH、HAVING、LIMIT、FROM、PREWHERE、token、UNION ALL、逗号、WHERE、ORDER BY、INTO OUTFILE、GROUP BY

任何建议表示赞赏

最佳答案

ClickHouse 目前不支持窗口函数。有一个rowNumberInAllBlocks您可能感兴趣的功能。

关于sql - 替换 clickhouse 中的 row_number(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53757415/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com