When I am running
SELECT concat(name,\'(\',substring(occupation,1,1),\')\')
FROM occupations
UNION ALL
SELECT concat(\'There are total \',count(occupati
SELECT concat(name,'(',substring(occupation,1,1),')') FROM occupations
UNION ALL SELECT concat('There are total ',count(occupation),' ', occupation,'.') FROM occupations GROUP BY occupation
ORDER BY name
there is no column named name
being returned in the above query.
You can use this instead.
SELECT concat(name,'(',substring(occupation,1,1),')') as name
FROM occupations
UNION ALL
SELECT concat('There are total ',count(occupation),' ', occupation,'.') as name
FROM occupations
GROUP BY occupation
ORDER BY name