DECLARE @SapCount INT=0 DECLARE @AppNum INT =0 SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox40*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox42*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox32*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox34*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox36*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox38*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox30*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox28*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox26*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum SELECT @AppNum=count(prn.intApplyID) FROM printReportName AS prn WHERE prn.AneZqspecial like '%checkBox24*True%' AND ID=@OpeId SET @SapCount=@SapCount+@AppNum
当需要字段某个值是否为true 多重like怎么优化
字符串如下
checkBox72*False|checkBox91*False|checkBox92*False|checkBox51*False|checkBox52*False|checkBox35*False|checkBox36*False|
checkBox113*False|checkBox114*False|checkBox150*False|checkBox133*False|checkBox134*False|checkBox73*False|checkBox74*False|
checkBox93*False|checkBox94*False|checkBox53*False|checkBox54*False|checkBox37*False|checkBox38*False|checkBox115*False|
ID与AneZqspecial字段都建索引了吗?
看看能不能用到分组求和。