sql >> Base de Datos >  >> RDS >> PostgreSQL

PostgreSQL - Cláusula GROUP BY

Cuando usa una cláusula "GROUP BY", debe encerrar todas las columnas que no están agrupadas en una función agregada. Intente agregar el título a la lista GROUP BY, o seleccione "min(a.title)" en su lugar.

SELECT COUNT(t.tag), a.title FROM a_tags t
JOIN w_articles2tag a2t ON a2t.tag = t.id 
JOIN w_article a ON a.id = a2t.article 
WHERE t.tag = 'css' OR t.tag = 'php' GROUP BY t.tag, a.title LIMIT 9