I have two tables:
project (id, name)
list (id, name, project_id)
I wanna get every project and number of list into the project.
I've tryed:
SELECT project.id, project.name, COUNT(list.id) AS list_count
FROM project
INNER JOIN list ON (list.project_id = project.id)
GROUP BY project.id DESC
But I get only the project that have list.
If the project don't own list, I don't get it...
I want list_count = 0 if COUNT(list_id) = 0, how must I do please ?
Use left join instead of Inner join
SELECT project.id, project.name, COUNT(list.id) AS list_count
FROM project
Left JOIN list ON (list.project_id = project.id)
GROUP BY project.id DESC
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I would like to replace/save data from another table into my WordPress databaseI wonder if you can write this one query or do it with PHP (this way is much slower !!) I would like the query to be: