Skip to content
Advertisement

GROUP BY within functions

I’m currently stuck with MySQL

I would love to make this SQL to use the COUNT for each id_customer that was GROUP BYed as well.
Picture of result
And now it takes COUNT for every id_customer so it divides everything by 6 instead of 3 for id_customer 3, 2 for id_customer 1 and 1 for id_customer 66.
Help would be appreciated!

Advertisement

Answer

Your query seems needlessly complex, I am pretty sure you can get the result you are after with simply

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement