select @receiveNum=@receiveNum+Count(*)
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
)对sql不熟
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
)对sql不熟
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
) t
select @receiveNum=@receiveNum+Count(*)
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
) t你是吧你面的查询语句作为表来查询,所以得去个别名t