select pu.point_user_id, pu.point,
(case when pu.point > 5000(평균치)then'잘하고 있어요'
else'더 열심히 ' end) as msg
from point_users pu
이제 5000대신 avg(pu.point)들어가면 되는데
select문으로 해 주어야 한다.
(select avg(pu.point)from point_users)
select pu.point_user_id,
pu.point,
(case when pu.pointe >(select avg (pu.point) from point_ussers)then '잘하고있어요'
else'더 열심히'end) as 'msg'
from point_user pu
substring_index 와 group by사용해 보기
select domain,count(*) as cnt from
(select substring_index(email.'@',-1) as domain from users )a
group by domain
select * from checkins c
where c.comment like '%화이팅%'