我想知道我是否可以根据我的" Style"轻松过滤我的结果。我的查询中的列。
select distinct
m.ManagerName,
p.ProductName,
p.slocumrank,
case
when s2.SubType2ID = 45 then 'Large Cap'
else s2.SubType2Name
End + ' ' + s1.SubType1Name as 'Style'
from QuantPerformance qp
where Style = 'ABCD'
目前,我的where语句会过滤掉所有内容。
答案 0 :(得分:2)
SELECT * FROM
(
SELECT DISTINCT ManagerName
, ProductName
, slocumrank
, case when SubType2ID = 45
then 'Large Cap'
else SubType2Name
End + ' ' + SubType1Name AS [Style]
from QuantPerformance
) A
where A.Style = 'ABCD'
SELECT DISTINCT ManagerName
, ProductName
, slocumrank
, case when SubType2ID = 45
then 'Large Cap'
else SubType2Name
End + ' ' + SubType1Name AS [Style]
from QuantPerformance
where case when SubType2ID = 45
then 'Large Cap'
else SubType2Name
End + ' ' + SubType1Name = 'ABCD'