What if you just didn't want to count the duplicates, or report the duplicates? But you don't want to delete anything.
Ex. Service code xyz is in GL 12345 and also in GL 34567, all other information is the same (account number, etc) i don't want to count or report the duplicate if it's already being counted or reported by the first GL in the hierarchy. Ex. if it's in GL 12345 then I don't want to count/report on it if it's also in GL 34567.
I found a way. In Oracle you would use the column value ROWID. In SQL Server you can use the column %%physloc%% to get a id for every row. If you want to remove one of the row in a table that has no unique index you can do something like this. Please test it out first before using it. delete from table a -- select a.*,%%physloc%% -- when testing it out where 0 = (select count(*) from table b where a.id = b.id and b.%%physloc%% > a.%%physloc%%)