Reputation: 15
I am wondering if I can easily filter my results based on my "Style" column in my query.
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'
Currently, my where statement filters out everything.
Upvotes: 1
Views: 3994
Reputation: 69504
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'
Upvotes: 5