a字段是什么啊?在插入的时候判断一下,还有你说具体一点 select distinct articleId from t_article_keyword where keyword in (${keywords}) 这个是不重复取出
把需要的记录抽出来放在新表吧: Select A, max(B) as B, max(C) as C Into NEW_TABLE From OLD_TABLE Group By A
Oracle下: //原来的表做一个备份 create table xxx_bak as select * from xxx; //清除原来表中的内容 delete from xxx a where a.rowid not in ( select max(rowid) from xxx b group by b.a );
delete from xxx a where a.rowid < ( select max(b.rowid) from xxx b where a.A=b.A );
select distinct articleId from t_article_keyword where keyword in (${keywords})
这个是不重复取出
Select A, max(B) as B, max(C) as C
Into NEW_TABLE
From OLD_TABLE
Group By A
//原来的表做一个备份
create table xxx_bak as select * from xxx;
//清除原来表中的内容
delete from xxx a
where a.rowid not in
(
select max(rowid)
from xxx b
group by b.a
);
where a.rowid < (
select max(b.rowid)
from xxx b
where a.A=b.A );