SQL 语句

去重字段里的值

SELECT  DISTINCT cat_id,goods_sn,repay FROM `ecs_goods` where cat_id != 20014

 

删除除去 去重字段
 DELETE FROM  `ecs_goods` where goods_id NOT IN (
 select bid from (select min(goods_id) as bid from `ecs_goods` group by cat_id,goods_sn,repay) as b
 );

posted @ 2018-11-26 13:43  暖心i  阅读(145)  评论(0编辑  收藏  举报