<s>[INST] Write a SQL code to identify the number of orders for each unique payment reference.  [/INST] SELECT order_payment_ref, COUNT(*) AS total_orders FROM order_transaction.transaction_detail_deprecated GROUP BY order_payment_ref; </s>