【问题标题】:Rounding in Google Query LanguageGoogle 查询语言中的四舍五入
【发布时间】:2011-10-10 01:33:09
【问题描述】:

我想用谷歌查询语言实现一系列带四舍五入的查询,例如:

select round(age,-1), count(id) group by round(age,-1)

或 int/floor/etc 的任意组合。

select int(age/10)*10, count(id) group by int(age/10)*10

有没有办法做到这一点?我怀疑没有,因为 GQL 中的标量函数列表非常有限,但想知道是否有解决方法。

http://code.google.com/apis/chart/interactive/docs/querylanguage.html#scalar_functions

【问题讨论】:

    标签: gql scalar


    【解决方案1】:

    在查询末尾添加格式,例如:

    "select age format age '0'"
    

    见Google Query Language Reference - Format。

    【讨论】:

      【解决方案2】:

      不,我认为我们不能在 GQL 中进行舍入...

      您显示的链接不适用于谷歌应用引擎...

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-06-15
        • 1970-01-01
        • 1970-01-01
        • 2011-01-02
        • 2023-01-12
        • 2012-08-04
        • 2023-03-26
        • 1970-01-01
        相关资源
        最近更新 更多