커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
질문 다시 드립니다.
[왕초보] 엑셀보다 쉽고 빠른 SQL v0
5주차
북마크
박*연
댓글
3
추천
0
조회수
12
조회수
12
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.



질문해결 버튼 눌러서 다시 확인 부탁드립니다.


스파르타 즉문즉답





작성한 코드 및 에러 메세지

SELECT cuisine_type,

    max(if(age=10, order_count, 0) "10대",

    max(if(age=20, order_count, 0) "20대",

    max(if(age=30, order_count, 0) "30대",

    max(if(age=40, order_count, 0) "40대",

    max(if(age=50, order_count, 0) "50대"

    from

    (

    SELECT f.cuisine_type,

  case when age < 20 and age > 10 then 10

   when age >= 20 and age < 30 then 20

   when age >= 30 and age < 40 then 30

   when age >= 40 and age < 50 then 40

   when age >= 50 and age < 60 then 50

   end age

  count(1) order_count

where age BETWEEN 10 and 59

from food_orders f inner join customers c on f.customer_id=c.customer_id

group by 1,2

) t

group by 1




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴