Presto sql 语句

  • cast() 函数的使用 将某种数据类型显式转换成另一种数据类型
  • cast('12' as integer)
    select 
    cast((year(current_date)-year(birth)) as integer) as age, 
    sum(price) as totalPrice 
    from record r 
    join user_dimension u on r.uid = u.uid 
    group by cast((year(current_date)-year(birth)) as integer) 
    order by totalPrice desc;

猜你喜欢

转载自my.oschina.net/u/1411151/blog/1822678