【问题标题】:how "order by" multiple SQL query如何“排序”多个 SQL 查询
【发布时间】: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


【解决方案1】:

好的,所以案例到此结束。看来我不能不回答这个问题就关闭这个踏板。

【讨论】:

    猜你喜欢
    • 2018-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    • 1970-01-01
    相关资源
    最近更新 更多