
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
4-9강의 1번 퀴즈 관련 입니다.
정답은 아래의 쿼리 입니다.
select pu.user_id,
pu.point,
(case when pu.point > (select round(avg(pu1.point),0) as avg from point_users pu1) then '잘 하고 있어요'
else '열심히 합시다!'end) as 'msg'
from point_users pu
정답에 대한 궁금증은 없는데요. with 구문으로도 할 수 있을거 같아서 with 구문으로 했더니 오류가 뜹니다.
아래의 with 구문에서 잘못 된 부분이 어딜까요?
또는 with 구문으로 할 수 없는 문제인가요?
with table1 as (select round(avg(pu1.point),0) as avg_point from point_users pu1)
select pu.user_id,
pu.point,
(case when pu.point > table1 a then '잘 하고 있어요'
else '열심히 합시다!'end) as 'msg'
from point_users pu
