对于十进制类型的列 BigQuery 为空
Null for a decimal type of column BigQuery
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 输出。
我该怎么做?
有简单的 NULL。它应该如下工作。
select cast(sum(case
when x.product = 'Apple' and x.colour ='RED'then round(x.price,2)
when x.product <> 'Apple' then NULL
ELSE 0
end) as decimal) as price
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 输出。
我该怎么做?
有简单的 NULL。它应该如下工作。
select cast(sum(case
when x.product = 'Apple' and x.colour ='RED'then round(x.price,2)
when x.product <> 'Apple' then NULL
ELSE 0
end) as decimal) as price