读书人

一下SQL语句有什么有关问题

发布时间: 2012-05-27 05:42:30 作者: rapoo

一下SQL语句有什么问题?
select @receiveNum=@receiveNum+Count(*)
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
)

对sql不熟

[解决办法]
select @receiveNum=@receiveNum+Count(*)
from (
select distinct(ProcessId)
from dbo.ProcessedInstance
where ApprovalOrgId=@orgId and AcceptanceTime>@stime and AcceptanceTime<@etime
) t
[解决办法]

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

读书人网 >SQL Server

热点推荐