Answer the question
In order to leave comments, you need to log in
? because week " />
Why does SELECT CASE WHEN only return the first value?
Tell me, please, what's wrong? Translates into Russian only the first value - the rest skips.
And it will turn out to group by week, writing `GROUP BY created_date;`? because week does not accept ...
SELECT
AVG(value) AS avg_value,
CASE LOWER(TO_CHAR(created_date, 'Day'))
WHEN 'monday' THEN 'Понедельник'
WHEN 'tuesday' THEN 'Вторник'
WHEN 'wednesday' THEN 'Среда'
WHEN 'thursday' THEN 'Четверг'
WHEN 'friday' THEN 'Пятница'
WHEN 'saturday' THEN 'Суббота'
WHEN 'sunday' THEN 'Воскресенье'
END week
FROM results
GROUP BY created_date;
Answer the question
In order to leave comments, you need to log in
But if you look at the documentation ...
Day full capitalized day name (blank-padded to 9 chars)
'monday' = 'monday '
SELECT
AVG(value) AS avg_value,
CASE WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'monday' THEN 'Понедельник'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'tuesday' THEN 'Вторник'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'wednesday' THEN 'Среда'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'thursday' THEN 'Четверг'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'friday' THEN 'Пятница'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'saturday' THEN 'Суббота'
WHEN LOWER(TO_CHAR(created_date, 'Day')) = 'sunday' THEN 'Воскресенье'
END week
FROM results
GROUP BY created_date;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question