【问题标题】:Bigquery ORDER BY (count )Bigquery ORDER BY (count )
【发布时间】:2014-06-02 21:12:30
【问题描述】:

我想在 Bigquery 中运行以下查询

SELECT table1.field1, COUNT(table1.fiels2)
FROM table1
GROUP BY table1.fiels1
ORDER BY COUNT(table1.fiels2)
DESC limit 10;

我收到错误错误:(L1:282):表达式 ORDER BY 中的 COUNT([metamx_magnetic_share.adops001.cookie], DESC) 无效

但我在 Vertica 上成功运行了相同的查询。

任何形式的帮助/建议都将不胜感激。

谢谢

【问题讨论】:

    标签: sql database google-bigquery


    【解决方案1】:

    你可以按别名排序,但不能按函数排序,所以试试:

    SELECT table1.field1, COUNT(table1.fiels2) as cnt
    FROM table1
    GROUP BY table1.fiels1
    ORDER BY cnt
    DESC limit 10;
    

    文档是here

    【讨论】:

      猜你喜欢
      • 2019-01-27
      • 2012-05-06
      • 2014-10-21
      • 2023-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多