Frustratingly, I\'m working with a table where the row name should be a value. How can I select that row in SQL Server based on a value? I\'m aiming at something that looks like
This can be done with standard SQL, albeit a bit ugly:
select i.item,
i.year,
i.model,
case i.model
when 'MODELA' then p.MODELA
when 'MODELB' then p.MODELB
when 'MODELC' then p.MODELC
when 'MODELD' then p.MODELD
end as price
from Items i INNER JOIN Pricing p ON p.year = i.year