How many business rates are there?
select count(*) from business_rates
What are the distinct cmi cross reference ids in those business rates?
select cmi_cross_ref_id from business_rates group by cmi_cross_ref_id
Show me the number of business rates related to each of them.
select cmi_cross_ref_id,count(*) from business_rates group by cmi_cross_ref_id
Include the master customer id too.
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