我有以下疑问:
SELECT *
FROM Table1
PIVOT
(
SUM(Value)
FOR [Period] IN ([06/1/2007],[07/1/2007])
)
AS p
返回的某些行是空的,但我想用 0 替换它们.
Some of the rows returned are null but i want to replace them with 0.
我试过 SUM(ISNULL(Value,0)) as Val
但它不起作用.(它说的语法不正确)
I've tried SUM(ISNULL(Value,0)) as Val
but it's not working. ( it's saying incorrect syntax)
哦,我在错误的地方使用了 ISNULL
.
Ohh, I was using ISNULL
in the wrong place.
查询应如下所示:
SELECT ID,ISNULL([06/1/2007],0), ISNULL([07/1/2007],0)
FROM Table1
PIVOT
(
SUM(Value)
FOR [Period] IN ([06/1/2007],[07/1/2007])
)
AS p
上一篇:如何根据python中的通用ID值将2列的垂直pandas表转换为水平表转换为、根据、水平、ID
下一篇:对于获得的JSONObject的Android应用程序Null值应用程序、Andr、JSONObject、Null