Using SQL Server 2014. Taking the following recordset:
I need to find a way to extract the ordOrderNum which is duplicates, with a different DeliveryNum. In this example, orders 93400460 and 93400467 would be extract, because they are duplicates. Order 93408170 is ok. How can I do that??!
thanks for your time and help
You can use group by
and having
:
select ordOrderNum
from mytable
group by ordOrderNum
having min(ordDeliveryNum) <> max(ordDeliveryNum)