If you had to calculate the average number of orders per supplier, you’re likely to start by doing a count of orders grouped by supplier ID.
The downside of this approach is that you exclude any suppliers that have not had orders.
Instead, start with suppliers and left outer join
to the orders table and then count
and group by
.
Seeing that a supplier has not had orders is also significant.
All this is to say that when building a report, consider what the complete picture is. Then start from the desired result and work your way inwards to the data.