I have one table of contact records and I'm trying to get the count of duplicate records that were created on each date. I'm not looking to include the original instance in the count. I'm using SQL Server. Here's an example table
| email | created_on |
| ------------- | ---------- |
| [email protected] | 08-16-22 |
| [email protected] | 08-16-22 |
| [email protected] | 08-16-22 |
| [email protected] | 07-12-22 |
| [email protected] | 07-12-22 |
| [email protected] | 06-08-22 |
| [email protected] | 06-08-22 |
| [email protected] | 04-21-22 |
And I'm expecting to return
| created_on | dupe_count |
| ---------- | ---------- |
| 08-16-22 | 3 |
| 07-12-22 | 2 |
| 06-08-22 | 0 |
| 04-21-22 | 0 |
Edited to add error message: error message