SELECT COUNT(A = '*' OR NULL) AS A,COUNT(B = '*' OR NULL) AS B,COUNT(C = '*' OR NULL) AS C,COUNT(D = '*' OR NULL) AS D FROM "table1"
请问为啥会报错,应该怎么解决
SELECT id,
sum(case when A='*' or A is null then 1 else 0 end) AS A,
sum(case when B='*' or A is null then 1 else 0 end) AS B,
sum(case when C='*' or A is null then 1 else 0 end) AS C,
sum(case when D='*' or A is null then 1 else 0 end) AS D
FROM
tabname group by id
-----------
【补充回答1】帆软运行也是可以的,你可以尝试在数据库跑一下,可以说明是帆软驱动问题,升级下驱动看看
【初始回答】你这个是mysql么,在数据库软件运行还是在帆软设计器运行。
我这边是可以的吖
你这么修改一下 试试 count改成sum( case when A='*' then 1 when A is null then 1 else 0 end )