I am newbie to MySQL and coming from Oracle background. I have a SQL query that computes the total count and percentage for type in a table.
For example:
SELECT type,count(*) count_by_type ,a.tot total, (COUNT(*)*100/a.total) percent
FROM xyz
JOIN (select count(*) tot from xyz)a
GROUP by type
HAVING type = 'abc';
This query is doing a self-join. Is there a simpler way to achieve the same?