[英]AWS Redshift SQL equivalent of Tableau
I have this code in tableau which I need to convert to Redshift SQL我在画面中有这段代码,我需要将其转换为 Redshift SQL
(
zn(
sum([Market_Price])
)-
zn(
sum(
if ISNULL([Market_Price]) then null else [Initial_Price] end
)
))/
zn(sum([Market_Price]))
I have tried but not getting the same results.我试过但没有得到相同的结果。 Do we have isnull and zn equivalent in Redshift? Redshift 中有 isnull 和 zn 等价物吗?
You can replace zn(X) with nvl(X,0)您可以将 zn(X) 替换为 nvl(X,0)
Something like this should work这样的事情应该工作
select (
coalesce(sum("Market_Price"),0) -
coalesce(sum(case when "Market_Price" is null then null else "Initial_Price" end ),0)
) / sum("Market_Price")
from your_redshift_table
;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.