We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This will work-
select concat(name,"(" ,left(occupation,1), ")" ) as summary
from occupations
union all
select concat("there are a total of " , count(*),' ' ,lower(occupation) ,"s.") as summary
from occupations
group by occupation
order by
case
when summary like "there are a total%" then 2 else 1
end,
summary;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The PADS
You are viewing a single comment's thread. Return to all comments →
This will work- select concat(name,"(" ,left(occupation,1), ")" ) as summary from occupations union all
select concat("there are a total of " , count(*),' ' ,lower(occupation) ,"s.") as summary from occupations group by occupation order by case when summary like "there are a total%" then 2 else 1 end, summary;