커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
order by 정렬이 안돼요
엑셀보다 쉽고 빠른 SQL v0
4주차
북마크
남*빈
댓글
5
추천
0
조회수
13
조회수
13
답변 완료

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

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


sum(price*discount)로 정렬해주고 싶은데

결과가 price를 기준으로 정렬됩니다

order by 3 해도 똑같아요


스파르타 즉문즉답




select  cuisine_type , sum(price) price, sum(price*discount) discount_price

from(

	select fo.cuisine_type , fo.price, (c.age-50)*0.005 discount

	from customers c left join food_orders fo on c.customer_id =fo.customer_id 

	where c.age>=50

)a

group by 1

order by 3 desc


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