Alice52 / database

ddf13ad8d4be76a80a336418b5cf5727bf6e3059
gitee.com
MIT License
0 stars 0 forks source link

[db] others #26

Open Alice52 opened 3 years ago

Alice52 commented 3 years ago
  1. 可以使用关联子查询去重

    DELETE FROM Products P1
    WHERE id < ( 
          SELECT MAX(P2.id) 
          FROM Products P2 
          WHERE P1.name = P2.name AND P1.price = P2.price
    ); 
  2. 去重- groupby-max+delete