1. 程式人生 > >case關聯表查詢

case關聯表查詢

lar null from then 員工 AS 聯表查詢 case 關聯表

select
a.員工編號,b.`姓名`,b.`地址`,
case
when a.收入 is null then ‘沒錢‘
when a.收入 < 2000 then ‘低收入‘
when a.收入 >=2000 and 收入 <=3000 then ‘中等收入‘
else ‘高收入‘
end as ‘收入水平‘
from salary a,employees b where a.員工編號=b.員工編號

case關聯表查詢