Skip to content
Advertisement

PHP, SQL-Query with IN clause troubleshooting

I have some problem with my Code, i tried to solve it on my own but i didnt found any matching solves.

So i have an array with User_ids…

JavaScript

…and i want to get the amount of tasks every user has 🙂

JavaScript

OUTPUT:

JavaScript

my problem is, that i was expecting 6 Users, not only 1. Im kinda stuck here, hope u can help me 😀

Thx a lot ^^

Advertisement

Answer

Thanks to “04FS” i could solve my problem! Now my results are displayed correctly 🙂 Thanks alot

  • This is due to your use of the aggregate function COUNT, without explicitly specifying proper GROUP BY criteria. – 04FS 10 mins ago
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement