How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n
create table cmi_cross_references (cmi_cross_ref_id varchar, master_customer_id varchar, PRIMARY KEY (cmi_cross_ref_id)); create table business_rates (cmi_cross_ref_id varchar, PRIMARY KEY (cmi_cross_ref_id))
select t2.cmi_cross_ref_id, t2.master_customer_id, count(*) from business_rates as t1 join cmi_cross_references as t2 on t1.cmi_cross_ref_id = t2.cmi_cross_ref_id group by t2.cmi_cross_ref_id