`avg(category_id)` will average, strangely, the `category_id` for the GROUP BY. `avg(sold)` will average, strangely enough, the `sold` for the GROUP BY. Note, however, that you `GROUP BY pro.product` so the above averages are calculated for each `pro.product` group.