SELECT granule_list.brand_id, granule_list.type, AVG(price_table.price), AVG(price_table.percent_diff) FROM granule_list, price_table WHERE (price_table.brand_id=granule_list.brand_id) GROUP BY granule_list.type
It is necessary that WHERE work only for AVG(price_table.price)
and AVG(price_table.percent_diff)
The fact is that the rows in the price_list table with the brand_id field equal to the brand_id field in the granule_list table may not exist. But this does not mean that you do not need to display the string, you need to display at least the fields granule_list.brand_id, granule_list.type and leave empty AVG (price_table.price) AVG (price_table.percent_diff). And my code does not display such a line at all.