Ver originalSELECT c.idcatventanilla, COUNT(a.idcatventanilla) Total FROM catventanilla c LEFT JOIN agenda a ON c.idcatventanilla = a.idcatventanilla WHERE TRUE AND c.idcatagencia= 'dk09a' AND horai = '2015-01-19 10:50' OR c.idcatventanilla IS NULL GROUP BY idcatventanilla ORDER BY total ASC