Is there a way to run a select statement from a "then" in the sql server case/when statement?
I read that select statment cannot be used inside case but is there a way achieve the below requirement. I cannot change the database design or table structure.
select c.name,c.address
case c.group
when 6500 then (select amt from Table1 Where cust_id = c.cust_id)
when 5450 then (select amt from Table2 Where cust_id = c.cust_id)
when 2010 then (select amt from Table3 Where cust_id = c.cust_id)
else 0
end as 'Amount'
From customers as c