我有一份报告,显示客户的初始和最近进度分数。使用的下拉过滤器之一是“员工”过滤器,允许用户选择“所有”员工或选择特定员工来过滤报告。 我遇到的问题是,当“工作人员”下拉过滤器设置为“全部”时,初始和最近的分数正确显示,但它没有正确显示(所有客户的初始和最新分数相同) )当过滤器设置为特定员工的姓名时。 由于我没有收到错误,我认为语法是正确的,问题必须与逻辑有关。我已经在下面提供了一个存储过程的片段。任何帮助表示赞赏。提前谢谢。
JOIN person familymember on familymember.idfamily = family.id
LEFT JOIN capCase cc on cc.idFamilymember = familymember.id
LEFT JOIN #applicantFamily on #applicantFamily.idfamily = Family.id --and isnumeric(@classroom) = 1
WHERE main.idSSMatrix = @idSSMatrix
AND main1.StartDate between @dateFrom AND @dateTo
AND ( cast ( main.IdProgram as varchar ) = @idProgram OR isnumeric(@idProgram) <> 1 )
AND ( cast ( cc.idType as varchar ) = @idProgramCapCase OR isnumeric(@idProgramCapCase) <> 1 )
AND (cast( main.idstaff as varchar) = @staff OR isnumeric( @staff) <> 1)
AND (isnumeric(#applicantFamily.idfamily ) = 1 or (isnumeric(@classroom) <> 1 ))
AND main1.id is not null