select a.id,case a.类型 when '1类' then b.[1类单价]
when '2类' then b.[2类单价]
when '3类' then b.[3类单价]
end as 单价
from a,b
where a.id=b.id --不知道是不是这么连接,楼主没说明
when '2类' then b.[2类单价]
when '3类' then b.[3类单价]
end as 单价
from a,b
where a.id=b.id --不知道是不是这么连接,楼主没说明
when '1类' then (select [1类单价] from b)
when '2类' then (select [2类单价] from b)
when '3类' then (select [3类单价] from b)
end
from a
B结构:ID,类型,单价
from a,b where a.类型=b.类型
select id,case 类型
when '1类' then (select [1类单价] from b)
when '2类' then (select [2类单价] from b)
when '3类' then (select [3类单价] from b)
end
from a