본문 바로가기
언어

case when -> having

by 땅호720 2024. 7. 15.
select distinct
case
when ((SKILL_CODE & (select sum(CODE) from SKILLCODES where CATEGORY = 'Front End'))
       and
       (SKILL_CODE & (select CODE from SKILLCODES where NAME = 'Python'))) then 'A'
when SKILL_CODE & (select CODE from SKILLCODES where NAME = 'C#') then 'B'
when SKILL_CODE & (select sum(CODE) from SKILLCODES where CATEGORY = 'Front End') then 'C'
else null
end as 'grade',
id,
email
from SKILLCODES s
join DEVELOPERS d
on s.CODE & d.SKILL_CODE
having grade is not null
order by grade, id

'언어' 카테고리의 다른 글

필터링 후 리턴 없을 때 null 출력하기  (0) 2024.07.22
누계 거리 순  (0) 2024.07.18
중복 제거  (0) 2024.07.12
format 소수 n번째 자리까지  (0) 2024.07.11
데이터 조합 형식  (0) 2024.07.10