
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
강의자료에는 나와있지 않지만 요일을 구하는 형식에서 date_format(date(date), '%W')를 입력하면
영어 요일(예: Wednesday)로 데이터를 구한다는 것을 알게되었습니다.
만약 요일을 한글로 치환하고 싶다면 아래 방식으로 쿼리를 추가 작성해야 하나요?
더 간편한 방법이 있나요?
select date(date) date_type,
date_format(date(date), '%Y') "년",
date_format(date(date), '%m') "월",
date_format(date(date), '%d') "일",
date_format(date(date), '%w') "요일",
case when date_format(date(date), '%w')=1 then '월'
when date_format(date(date), '%w')=2 then '화'
when date_format(date(date), '%w')=3 then '수'
when date_format(date(date), '%w')=4 then '목'
when date_format(date(date), '%w')=5 then '금'
when date_format(date(date), '%w')=6 then '토'
when date_format(date(date), '%w')=0 then '일'
end
from payments
