MySQL GROUP BY

This page is marked as In Progress so expect small errors or unfinished bits

Although you may often want to list all entries in a database table sometimes you will just want a summary of some sort. For example, you might want to list total order values for customers:

$query="SELECT customerId, SUM(price) FROM orders GROUP BY customerId";
        
submit to reddit Delicious Tweet