我一直在搜索,但没有找到解决问题的方法
我正在使用SSRS本机模式,我想根据参数@idRiskType创建一个带过滤器的报告。
考虑下表:( risktrail)
我创建了一个存储过程来查找所有客户的最后一种风险类型,它运行正常。这是:
CREATE procedure [dbo].[byRisk] @riskType int
as
select c.idCustomer, rsTrail.idRiskType
from customer as c
cross apply
(select top 1 idRiskType
from risktrail
where risktrail.idCustomer = c.idCustomer
order by idTrail desc) as rsTrail
此存储过程超出以下内容:
答案 0 :(得分:2)
CREATE procedure [dbo].[byRisk] @riskType int
as
select c.idCustomer, rsTrail.idRiskType
from customer as c
cross apply
(select top 1 idRiskType
from risktrail
where risktrail.idCustomer = c.idCustomer
order by idTrail desc) as rsTrail
where rsTrail.idRiskType = @idRiskType