select v.vend_id, count(p.prod_id) as prod_id from Vendors v left join Products p on v.vend_id = p.vend_id group by v.vend_id order by v.vend_id;
使用左外连接,然后按vendors表的id分组,因为是以左表作为基准