问题
I have an Sqlite3 database with a table like this:
Table(com1, com2)
A || B
B || A
C || D
D || B
B || D
If I have 2 rows: A || B, and B || A, I want to delete one of them (I don't care which one).
So to obtain:
A || B
C || D
D || B
I've read the many asks about duplicate rows but I cant find something like this. Thanks for any help.
回答1:
I think solution for your problem should look like this:
SELECT
t1.val1,t1.val2
FROM table AS t1
JOIN table AS t2 ON (
(t1.val1=t2.val2) AND (t1.val2=t2.val1)
) WHERE t1.val1<=t1.val2
where table is the name of your table and val1 and val2 are names of columns in that table.
来源:https://stackoverflow.com/questions/13209289/remove-almost-duplicate-rows