Mam takie 3 zapytania: (1 tabela)
SELECT count(id) AS ok FROM comments WHERE receiver_id = '10' AND reference = 'positive', SELECT count(id) AS nok FROM comments WHERE receiver_id = '10' AND reference = 'negative', SELECT count(id) AS comments FROM comments WHERE receiver_id = '10' AND comments IS NOT NULL
Chciałbym zrobic z tego 1 zapytanie, które zwróciły 1 wiersz z 3 wartosciami ok, nok, comments.
W jaki sposób najlepiej to zrobic?
Juz nieaktualne . Znalazłem rozwiazanie
SELECT count( DISTINCT IF( reference = 'positive', ID, NULL ) ) , count( DISTINCT IF( reference = 'negative', ID, NULL ) ) , count( DISTINCT IF( comments IS NOT NULL , ID, NULL ) ) FROM meeting_comments WHERE receiver_id = '10'