sql 查询优化:COUNT(*)改成COUNT(1)
This commit is contained in:
@@ -1639,9 +1639,9 @@ left join (select PlanNum,RealNum,QuantityListId from JDGL_QuantityCompletion wh
|
||||
FROM GJSX
|
||||
LEFT JOIN Sys_User AS users ON users.UserId =@userId
|
||||
WHERE GJSX.ProjectId=@projectId AND
|
||||
GJSX.State != 0 AND (((select count(*) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0
|
||||
and (select count(*) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0)
|
||||
or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(*) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(*) from GJSX_Process process where process.GJSXID=GJSX.GJSXID))
|
||||
GJSX.State != 0 AND (((select count(1) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0
|
||||
and (select count(1) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0)
|
||||
or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(1) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(1) from GJSX_Process process where process.GJSXID=GJSX.GJSXID))
|
||||
)
|
||||
UNION ALL
|
||||
SELECT GJSXID AS DataId
|
||||
@@ -1721,9 +1721,9 @@ left join (select PlanNum,RealNum,QuantityListId from JDGL_QuantityCompletion wh
|
||||
FROM GJSX
|
||||
LEFT JOIN Sys_User AS users ON users.UserId =@userId
|
||||
WHERE GJSX.ProjectId=@projectId AND
|
||||
GJSX.State != 0 AND (((select count(*) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0
|
||||
and (select count(*) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0)
|
||||
or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(*) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(*) from GJSX_Process process where process.GJSXID=GJSX.GJSXID))
|
||||
GJSX.State != 0 AND (((select count(1) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0
|
||||
and (select count(1) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0)
|
||||
or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(1) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(1) from GJSX_Process process where process.GJSXID=GJSX.GJSXID))
|
||||
)
|
||||
UNION ALL
|
||||
SELECT GJSXID AS DataId
|
||||
|
||||
Reference in New Issue
Block a user