[求助]SQL的存储过程改为视图
请高手帮我把下面的存储过程改为视图..谢谢..create procedure spRoomSale
@StartDate smalldatetime,
@EndDate smalldatetime
as
select rtype,rname,
(select sum(cCost) from tblClient
left join tblRoom on tblClient.rnum=tblRoom.rnum
where (tblClient.cInTime between @StartDate and @EndDate)
and (tblRoomType.rtype=tblRoom.rtype)
)as sale,
(select count(tblClient.cId)from tblClient
left join tblRoom on tblClient.rnum=tblRoom.rnum
where (tblClient.cInTime between @StartDate and @EndDate)
and (tblRoomType.rtype=tblRoom.rtype)
)as salenum
from tblRoomType
GO 视图和存储过程不是等价的,@StartDate 和 @EndDate 在视图中无法使用 我知道这两个变量在视图里面没办法实现,但可以用别的代替的不是吗?
@StartDate是起始日期,@EndDate是终止日期. 视图是不能传参数的吧
页:
[1]
