-- Database schema
| Customer_Master_Index : master_customer_id [ INT ] primary_key , cmi_details [ TEXT ] | CMI_Cross_References : cmi_cross_ref_id [ INT ] primary_key , master_customer_id [ INT ] CMI_Cross_References.master_customer_id = Customer_Master_Index.master_customer_id , source_system_code [ TEXT ] | Council_Tax : council_tax_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Council_Tax.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id | Business_Rates : business_rates_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Business_Rates.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id | Benefits_Overpayments : council_tax_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Benefits_Overpayments.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id | Parking_Fines : council_tax_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Parking_Fines.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id | Rent_Arrears : council_tax_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Rent_Arrears.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id | Electoral_Register : electoral_register_id [ INT ] primary_key , cmi_cross_ref_id [ INT ] Electoral_Register.cmi_cross_ref_id = CMI_Cross_References.cmi_cross_ref_id |
-- -- How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n

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;