receipt_id order_id
1 A
2 B
3 B
4 C
5 C
order_id のカウントが 1 より大きいこのテーブルのすべてのレコードを表示する SQL コードは何ですか?
集計関数が必要なだけですGROUP BY
select order_id
from yourtable
group by order_id
having count(order_id) > 1
デモで SQL Fiddle を参照してください
これを試して:
Select * from table where order_id in (select distinct order_id
from table
group by order_id
having count(order_id) > 1)