hi all,I have a table structure like thisNr Name Code------------------------111 Kuchen DE111 Kuchen AT111 Obst OP122 Stein OP132 Kuchen AT132 Glas OPIn the line 1 and 2 there are almost the same entries. they are only different in the code. I need to cleanup this. All entries with the same Nr and Name have to be merged together and get the Code "DE"there are 3 types of code: DE, AT and OP. OP entries are always unique, so there is no problem with them. Entries with the code DE and AT can be duplicates. If there is a duplicate like in the line 1 and two, the line with the Code AT should be not selected.I have already worked on this and I can select the duplicates and clear them. Here is the code:select Nr, Name, 'De'from ( select Nr, Name, Code from Database_All where Code <> '--' and (Code = 'DE' or Code='AT') group by 1,2,3 ) as temp group by 1,2 having count(*) > 1
I need now the rest. The values that have no duplicates. Then I can merge this 2 results