Mysql
 sql >> Database >  >> RDS >> Mysql

cerco una leggera variante di GROUP BY

SELECT T.attr,
       COUNT(Y.id)
FROM   (SELECT 'A' AS attr
        UNION ALL
        SELECT 'B') AS T
       LEFT JOIN YourTable Y
         ON Y.attr = T.attr
GROUP  BY T.attr