Showing posts with label group by. Show all posts
Showing posts with label group by. Show all posts

What does the numbers in the SQL clause “GROUP BY 1” mean?


SELECT account_id, open_emp_id
         ^^^^        ^^^^
          1           2

FROM account
GROUP BY 1;

GROUP BY 1 refers to the first column in select statement which is account_id.