Count the number of orders for each unique merchant order reference.

SELECT order_merchant_order_ref, COUNT(*) AS total_orders
FROM order_transaction.transaction_detail_deprecated
GROUP BY order_merchant_order_ref;