【发布时间】:2022-01-22 18:35:12
【问题描述】:
cast(sum(case
when x.product = 'APPLE' and x.colour ='RED'then round(x.price1,2)
when x.product <> 'APPLE' then **'NULL'**
ELSE 0
end) as decimal) as price,
price 列的类型为 decimal。但我只想在第二个 when 语句中输出 Null 而不是十进制值。
我该怎么做?
【问题讨论】:
-
select x.product, cast(sum(case when x.product = 'Apple' and x.colour ='RED'then round(x.price,2) when x.product ' Apple' 然后 NULL ELSE 0 end) as decimal) as price
标签: google-bigquery null decimal