Count the number of shops for each unique pos reference id.

SELECT shop_pos_reference_id, COUNT(*) AS total_shops_per_pos_reference_id
FROM order_transaction.transaction_detail_deprecated
GROUP BY shop_pos_reference_id;