Alias pour la colonne du Case Statement
Salut à tous,
Je n'arrive pas a mettre un alias pour la nouvelle colonne qui va etre creee dans la requete dessous:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| SELECT month(r.date),count(r.id),
case
when (year(current_date)-year(u.dateOfBirth))between 18 and 24 then '18 and 24'
when (year(current_date)-year(u.dateOfBirth)) between 25 and 34 then '25 and 34'
when (year(current_date)-year(u.dateOfBirth)) between 35 and 44 then '35 and 44'
when (year(current_date)-year(u.dateOfBirth)) between 45 and 54 then '45 and 54'
when (year(current_date)-year(u.dateOfBirth)) between 55 and 64 then '55 and 64'
when (year(current_date)-year(u.dateOfBirth)) > 65 then '65 et plus'
end
FROM Review r
JOIN r.user u
where u.userType = AccessUser or u.userType = PremiumUser
GROUP BY month(r.date) |
Je veux faire un group by sur la nouvelle colonne. Est-ce que c'est possible de mettre un alias apres le mot cle End du Case statement?
Quelqu'un pourra m'aider svp
Cdt,
Neerou