I have two tables -> Order and OrderLine. Order contains header information and is the 1 side of the one to many relationship. OrderLine contains the lines that make up an order and is the many side.

Lets say I have 3 orders, each with their own Ids, but the orderline data for each is identical, I consider that to be duplication, but only if all of the records in the group are identical.

I have tried using CheckSum\_Agg for this, but it yields a large number of false positives resulting in records being deleted that are not exact duplicates.

Trying to avoid a nasty, laborious nested cursor.

Any ideas?

Post Edit:
--An example of a false positive being returned by CheckSum\_Agg...

```
Create Table #OrderLine(OrderId Int,ProductTypeId Int,ProductId Int);
Insert Into #OrderLine(OrderId,ProductTypeId,ProductId)
Values(1,1,5),(1,2,6),(2,1,6),(2,2,5)

Select CHECKSUM_Agg(ProductTypeId),CHECKSUM_Agg(ProductId)
From #OrderLine
Group By OrderId

Drop Table #OrderLine

```