我想爲每個用戶相冊統計照片數量,一切順利,直到用戶沒有在一個相冊中的照片,然後(我認爲)WHERE ap.del = 0
做那個相冊沒有出現。請幫助,DB是Postgresql!SQL連接問題
SELECT a.id_album, a.id_osoba, a.name, a.description, a.privacy, a.del, a.data_del, a.cover, a.date, count(ap.id_album_photo) AS ilosc
FROM album a
LEFT JOIN album_photo ap ON ap.id_album = a.id_album
WHERE ap.del = 0
GROUP BY a.id_album, a.id_osoba, a.name, a.description, a.privacy, a.del, a.data_del, a.cover, a.date
ORDER BY a.name;