I have a table which looks something like this:
+------------+------------+--------------+
| Date | Name | Certificates |
+------------+------------+--------------+
| 2021-02-01 | Jason | 3 |
| 2021-02-01 | Nisha | 4 |
| 2021-02-01 | Zaid | 5 |
| 2021-03-25 | Aniket | 4 |
| 2021-03-25 | Anish | 2 |
| 2021-03-25 | Nadia | 0 |
| 2021-05-06 | Aadil | 7 |
| 2021-05-06 | Ashish | 1 |
| 2021-05-06 | Rahil | 9 |
+------------+------------+--------------+
This result is obtained by performing the following SQL query:
SELECT
Date, Name, COUNT(Certificates) as Certificates
FROM Students.data
GROUP BY Date, Name
ORDER BY Date, Name;
After receiving this result, ideally, I would like only the first entry from each date now (that would basically be the first name for each date), which should be something like this:
+------------+------------+--------------+
| Date | Name | Certificates |
+------------+------------+--------------+
| 2021-02-01 | Jason | 3 |
| 2021-03-25 | Aniket | 4 |
| 2021-05-06 | Aadil | 7 |
+------------+------------+--------------+
Is there a way I can modify the above group by query to obtain the result, or do I need to pass the result of this query to some other query, if so, what would that query be. Thanks.
Also, the database I am using is Clickhouse.
NOTE: Please let me know if there is any issue with the question, can clarify that.