Witam

Mam takie 3 zapytania: (1 tabela)
  1. SELECT count(id) AS ok FROM comments WHERE receiver_id = '10' AND reference = 'positive',
  2. SELECT count(id) AS nok FROM comments WHERE receiver_id = '10' AND reference = 'negative',
  3. 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

  1. SELECT count( DISTINCT IF( reference = 'positive', ID, NULL ) ) , count( DISTINCT IF( reference = 'negative', ID, NULL ) ) , count( DISTINCT IF( comments IS NOT NULL , ID, NULL ) )
  2. FROM meeting_comments WHERE receiver_id = '10'