Start here
Using GROUP BY With INNER JOIN in MySQL
Learn how GROUP BY works with INNER JOIN in MySQL, with a worked example, clause order, HAVING filters, LEFT JOIN and the ONLY_FULL_GROUP_BY error.
Writing SQL
Combining inner joins with GROUP BY and ORDER BY, and grouping with or without aggregates.
Start here
Learn how GROUP BY works with INNER JOIN in MySQL, with a worked example, clause order, HAVING filters, LEFT JOIN and the ONLY_FULL_GROUP_BY error.
Yes, you can use GROUP BY without an aggregate function. It returns each distinct value once, much like DISTINCT, and shows where MySQL raises an error.
An inner join query uses INNER JOIN and an ON condition to return only rows that match in both tables, with the syntax, an example and common mistakes.
An inner join returns only matching rows, while an outer join also keeps unmatched rows. This guide walks through LEFT and RIGHT JOIN with sample data.
GROUP BY runs before ORDER BY in SQL. Here is the order SQL processes clauses in, with a sales example that groups totals and then sorts them.
Related topics