sqlite - SQL: remove duplicate rows across columns -


i have table loaded sqlite in following format:

player1 player2 player1probability player2probability john    peter   0.6                0.4 peter   john    0.4                0.6 mary    bob     0.8                0.2 bob     mary    0.2                0.8 

as can see, there duplicates across different columns. first 2 rows identical in data provide: can see john has 0.6 probability , peter has 0.4 first row, while second row duplicates information.

is there way remove duplicated rows through sql query?

this how i'd in mysql, i'm hoping can done in sqlite.

delete t1.* yourtable t1 join yourtable t2  on t1.player1 = t2.player2      , t1.player2 = t2.player1      , t1.player1 > t1.player2 

another way:

delete yourtable t1 exists (select *               yourtable t2               t1.player1 = t2.player2                  , t1.player2 = t1.player1                  , t2.player1 < t1.player2) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -