Im currently running a SQLBase database and tried several was to select and delete duplicate items.
Here a scenario:
Tablename: test1
||=========||=========||==================||
|| column1 || column2 || rowid ||
||=========||=========||==================||
|| 1 || 1 || AAAAAAAAAAAAAAAA ||
|| 1 || 1 || BBBBBBBBBBBBBBBB ||
|| 1 || 1 || CCCCCCCCCCCCCCCC ||
|| 1 || 2 || DDDDDDDDDDDDDDDD ||
|| 1 || 2 || EEEEEEEEEEEEEEEE ||
|| 1 || 3 || FFFFFFFFFFFFFFFF ||
|| 1 || 4 || GGGGGGGGGGGGGGGG ||
||=========||=========||==================||
RowID is a virtual column. This gets created by the system.
What I want to do is delete all duplicates so I end up with:
||=========||=========||==================||
|| column1 || column2 || rowid ||
||=========||=========||==================||
|| 1 || 1 || AAAAAAAAAAAAAAAA ||
|| 1 || 2 || DDDDDDDDDDDDDDDD ||
|| 1 || 3 || FFFFFFFFFFFFFFFF ||
|| 1 || 4 || GGGGGGGGGGGGGGGG ||
||=========||=========||==================||
The problem is, its in SQLBase and there is no function that iterates my duplicates.
I find duplicates like:
SELECT column1, column2 COUNT(*)
FROM test1
GROUP BY column1, column2
HAVING COUNT(*) > 1;
And there is my problem. Can't find a way to delete them from that point on.
Also I obviously can't add the rowid
to the duplicate select because of the group by
statement.
Are there any possibilitys delete the duplicates so having only one entry each combination of column1
und column2
?