In my last blog, I discussed the Use of Case() in MySQL and after publishing that post after a few days as usual while solving this specific Problem 1693. Daily Leads and Partners at LeetCode. I have used Group By several times but never used it in this particular way – “GROUP BY 1, 2, 3”. After going through several blogs and forums I have found out that its a shortcut to denoting the column in a series, such as;
Here 1 will be referring 1=> data_id, 2=> make_name and so on

For the solution to this problem, I have used the following query;
SELECT date_id, make_name, COUNT(DISTINCT lead_id) AS unique_leads, COUNT(DISTINCT partner_id) AS unique_partners
FROM DailySales
GROUP BY 1, 2;Happy learning 💻💻
References
- https://stackoverflow.com/questions/7392730/what-does-sql-clause-group-by-1-mean
- https://dba.stackexchange.com/questions/86609/why-do-we-use-group-by-1-and-group-by-1-2-3-in-sql-query
- https://www.getdbt.com/blog/write-better-sql-a-defense-of-group-by-1/
- https://www.quora.com/What-does-the-SQL-clause-Group-BY-1-mean
