I'm trying to delete some rows from my Mysql table, when one key is duplicate (here "url") and keep a particular one (here the smallest "key1" and "key2")
Example :
Table t1
Id    Url    Key1    Key2
1     A.com   10      10
2     B.com   20      25
3     B.com   21      25
4     C.com   35      35
5     C.com   35      37
Desired output is :
Table t1
Id    Url    Key1    Key2
1     A.com   10      10
3     B.com   21      25
5     C.com   35      37
So the query (if it exists) should look like :
- Select rows where Url are duplicate
- Then sort by Key1 and remove the row where Key1 is strictly inferior
- if Key1 are equal, remove the row where Key2 is inferior
Thanks
 
     
    