Is the chart diagram (shown below) missing something?
I say this because when we are only looking at the columns user_id and amount we see that only 2 distinct values display under amount 24.99 and 12.99. (I will use user_189 as an example thoughout this question)
If this is true how is possible that the sum grouped by user is anything other than 12.99 or 24.99?
In other words, what exactly are we adding together if there is only one column containing value?
Does it actually look something like this??
Even when I include the pay_date I can see that only one payment shows up for this user.
Any ideas what’s going on here? Where are the other payments???
EDIT: It looks like I can only include one photo as a new user. Hopefully you can still piece together what I’m talking about.
I’m not sure I quite understand what you are asking. I queried the payments table first for the sum of payments for only the user with user_id 189. I also queried the payments table for all columns where user_id is 189. These are the results:
User #189 made a total of 9 payments totaling $152.91.
Logically if more than zero then it means there was a payment?. What would be a disadvantages to do it that way?.
The one I can think of now is by using aggregate (bigger than zero) with WHERE function which may make higher impact on performance?. Is “bigger than” counted as aggregate?
I believe HAVING doesn’t have to be used with all aggregate functions, only with the GROUP BY aggregate function. That’s why HAVING is always used right after GROUP BY.
it’s pretty frustrating when you’ve done it all correctly but it’s “wrong” due to you displaying too many columns or something. it’s not the end of the world but it’s a bit silly