Is it possible to GROUP BY multiple columns using MySQL?
Is it possible to GROUP BY
more than one column in a MySQL SELECT
query? For example:
GROUP BY fV.tier_id AND 'f.form_template_id'
Solution 1:
GROUP BY col1, col2, col3
Solution 2:
Yes, you can group by multiple columns. For example,
SELECT * FROM table
GROUP BY col1, col2
The results will first be grouped by col1, then by col2. In MySQL, column preference goes from left to right.