【发布时间】:2020-04-19 10:22:43
【问题描述】:
我有这个多 SQL 查询,它显示表中的所有重复行...
#standardSQL
SELECT COUNT(*) as num_duplicate_rows, * FROM
`data-to-insights.ecommerce.all_sessions_raw`
GROUP BY
fullVisitorId, channelGrouping, time, country, city, totalTransactionRevenue, transactions, timeOnSite, pageviews, sessionQualityDim, date, visitId, type, productRefundAmount, productQuantity, productPrice, productRevenue, productSKU, v2ProductName, v2ProductCategory, productVariant, currencyCode, itemQuantity, itemRevenue, transactionRevenue, transactionId, pageTitle, searchKeyword, pagePathLevel1, eCommerceAction_type, eCommerceAction_step, eCommerceAction_option
HAVING num_duplicate_rows > 1;
我的问题是如何修改此 SQL 查询以按某些列的顺序显示结果,例如fullVisitorId
如果我把最后一行命令的 and 放在...不起作用
HAVING num_duplicate_rows > 1; ORDER BY fullVisitorId
我收到了这个错误
Syntax error: Unexpected keyword ORDER at [6:32]
【问题讨论】:
-
删除
;并运行。 -
感谢 Neel,现在开始工作
标签: sql google-bigquery