I have a query:
select
index_imsid
, SUM(weighted_value) sumWeightedValue
, (
select
top 1 percentof
, [Plan_Name_OR_Payment_Type]
from [v_PlanPerProvider1]
where [PLAN_RANK]=1
) plan1
from [v_PlanPerProvider1]
where plan_rank between 1 and 10
group by index_imsid
order by 1
and I am getting this error:
Msg 116, Level 16, State 1, Line 3
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
Can you please help me to understand why I am getting this error?
It appears that it does not like the select statement as one of the columns?
It does not like you selecting two columns in the subquery. You can only select one column at a time.