# What's wrong with my code? Followed video

**URL:** <https://forum.codewithmosh.com/t/whats-wrong-with-my-code-followed-video/71992>\
**Category:** Uncategorized\
**Created:** [December 16, 2025, 4:58pm UTC](https://forum.codewithmosh.com/t/whats-wrong-with-my-code-followed-video/71992 "2025-12-16T16:58:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![molly](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@molly](https://forum.codewithmosh.com/u/molly)\
**Post date:** [December 16, 2025, 4:58pm UTC](https://forum.codewithmosh.com/t/whats-wrong-with-my-code-followed-video/71992/1 "2025-12-16T16:58:13Z")

</div>

USE sql\_invoicing;  
select  
date,  
sum(amount) as total\_payments

from payments

group by date  
order by date

THE sum is blackened. Problem with it? Error:

| 0 | 20 | 16:32:51 | select date, sum(amounts) as total\_payments from payments group by date order by date LIMIT 0, 5000 | Error Code: 1146. Table ‘sql\_store.payments’ doesn’t exist | 0.016 sec |
| --- | --- | --- | --- | --- | --- |

---

<div class="post-metadata">

**Author:** ![molly](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@molly](https://forum.codewithmosh.com/u/molly)\
**Post date:** [December 16, 2025, 6:20pm UTC](https://forum.codewithmosh.com/t/whats-wrong-with-my-code-followed-video/71992/2 "2025-12-16T18:20:21Z")

</div>

Summarising Data - The Group By clause video

---

<div class="post-metadata">

**Author:** ![Shehu](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@Shehu](https://forum.codewithmosh.com/u/Shehu)\
**Post date:** [January 5, 2026, 9:44pm UTC](https://forum.codewithmosh.com/t/whats-wrong-with-my-code-followed-video/71992/3 "2026-01-05T21:44:11Z")

</div>

It means that MySQL cannot find the table `payments` in the `sql_store` database.  
This is **not** a syntax problem with your `SUM()` query — it’s a **missing table/database** issue.

1. **Wrong database selected** — You might be connected to `sql_store`, but that database doesn’t have a `payments` table.

2. **Table name mismatch** — The table might have a different name (e.g., `payment`, `customer_payments`, `orders`).

3. **Database not loaded** — If you’re following a tutorial (like Mosh Hamedani’s SQL course), the sample database might not have been imported.
