In accurate data

I’m currently on the Aggrevate Functions Exercise and my results are not same under my “total_payments” and “what_we_expect” column. I restored the databases as instructed yet not all of my numbers the same. Did Mosh recently upload different sql files? Is any one else experiencing the same thing?

Here’s my results:


That’s interesting :face_with_monocle:.

I made the query again, and I got different values than Mosh’s… and yours!! Anyway, if you add total_payments and what_to_expect, you get the total_sales… which in my query and Mosh’s agree… but not yours. double check the what_to_expect column query… something may be wrong in that SUM().

I made a quick query, to check the values of the whole 2019 year. Use these values to check your table:

I’ve had some differences between my results and Mosh’s, but what I really care is that the queries are well written.

Hi @NicolasATC,

My invoice data is the exact same as yours, and the only thing that was different about my query is “(invoice_total - payment_total) AS what_we_expect” without the SUM function. I get the same results with or without it.

Is there anything else you suggest? If not, I guess I’ll continue this course as is, but it is gonna be a little frustrating getting different results.

Would you mind sharing an screeshot of your code and the result?? just like I did in my screenshots. Maybe an addional pair of eyes can help you find the error.

Here you go:




I only found 2 differences… and those 2 make a big difference in the results.

You wrote:
WHERE invoice_date BETWEEN '2019-07-01' AND '2019-12-30'

And it should include June 30th… and December 31st. So change the dates to:

WHERE invoice_date BETWEEN '2019-06-30' AND '2019-12-31'

I’m not sure if this is enough for the results to match, but if they don’t, I suggest you create another server download everything again and redo all the database.

Let me know how it goes.


Cool… we have a match in data. :smiley: I’m using your same code I have the same results

Now, consider changing the dates… according to my last post. And again. Post picture of the query and the results. In this query, I’m including JUne 30 and December 31:

Here they are:



Okay I will, thanks for your help.

It seems we have the same data … weird that my data doesn’t match Mosh’s… but that’s ok for me. I think that designing courses is not an easy task.

I’m glad I could help you to figure it out.

1 Like