2

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.

SomeoneMe
  • 21
  • 3
  • It will be easier to help you with your code if you post at least an attempt of your own. – ghoti Nov 03 '12 at 13:00

1 Answers1

0

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
MichalHlavacek
  • 324
  • 3
  • 15