Question:
How do I arrange to sort within a GROUP BY clauserather than over the complete result set, e.g.
L0 PDV …… L90 PDV …… L180 PDV …… L270 PDV …… L0 PPE …… L90 PPE ……I want to force col1 to be sorted within each group.
Answer:
If you GROUP BY both columns, the results will be sortedas you’ve described:
SELECT col1, col2 FROM Table [WHERE clause if necessary] GROUP BY col2, col1;Alternatively, you could add the ORDER BY clause:
SELECT col1, col2 FROM Table [WHERE clause if necessary] GROUP BY col1, col2 ORDER BY col2;
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.






















