Ok, my SQL is getting a little rusty, but in your original query, the reason you are getting so many rows is because you are basically selecting all rows from the table. You need a sub select statement to limit the return row count.
I would have to test a few queries, but you should be able to use the MAX function to return the largest count from the COUNT sub selection.
Google for SQL MAX function for some examples.
EDIT: This is
generally what you're looking for...
Code:
SELECT order_id, reference_id FROM order_products
GROUP BY reference_id
HAVING COUNT(*) > 1