嵌套Sql语句,大家帮忙看看 这么写?
HEALTH_JK_CheckResult
就这一张表。
想实现,根据一定的条件count出信息 作为一列,类似如下的样子,但是这样报错。请问怎么写?
select count(select * from HEALTH_JK_CheckResult where charindex('血脂升高',chkresult)>0) as xuezhisg,
count(*) as gaoxuey
from HEALTH_JK_CheckResult
------解决方案--------------------SQL code
select
count(select * from HEALTH_JK_CheckResult where charindex('血脂升高',chkresult)> 0) as xuezhisg,
count(*) as gaoxuey
from HEALTH_JK_CheckResult