PROJET AUTOBLOG


Shaarli - Les petits liens d'Alda

Site original : Shaarli - Les petits liens d'Alda

⇐ retour index

sql - Postgresql Multiple counts for one table - Stack Overflow

jeudi 3 avril 2014 à 19:17
La même avec MariaDB (ou MySQL):

SELECT type, SUM((place = 'home')), SUM((place = 'school')), … FROM reports GROUP BY type

Comme indiqué ici: http://stackoverflow.com/a/17086564, c'est parce que true casté en int vaut 1 (et false vaut 0)
(Permalink)