By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Records: 4 Duplicates: 0 Warnings: 0
| id | date | url | EXTRA_COLUMNS |
|---|---|---|---|
| 1 | 2023-06-21 00:00:00 | https://example1.com/en | ... |
| 2 | 2023-06-20 23:00:00 | https://example1.com/uk | ... |
| 3 | 2023-06-20 14:00:00 | https://example2.com/en/about | ... |
| 4 | 2023-06-21 03:00:00 | https://example2.com/fr | ... |
| id | date | domain |
|---|---|---|
| 1 | 2023-06-21 00:00:00 | example1.com |
| 2 | 2023-06-20 23:00:00 | example1.com |
| 3 | 2023-06-20 14:00:00 | example2.com |
| 4 | 2023-06-21 03:00:00 | example2.com |
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(partition by domain order by date desc) rn from ( SELECT *, SUBSTR' at line 3
| id | date | url | EXTRA_COLUMNS | domain | domain | lastdate |
|---|---|---|---|---|---|---|
| 1 | 2023-06-21 00:00:00 | https://example1.com/en | ... | example1.com | example1.com | 2023-06-21 00:00:00 |
| 4 | 2023-06-21 03:00:00 | https://example2.com/fr | ... | example2.com | example2.com | 2023-06-21 03:00:00 |
| id | date | URL |
|---|---|---|
| 4 | 2023-06-21 03:00:00 | https://example2.com/fr |