Oracle 合并表中的相同数据

2014-11-24 18:46:18 · 作者: · 浏览: 4

--合并关键字的命中率到一个字段
update table b set b.times=(
select c.cout from (
select a.keyword,count(*) as cout,min(a.rowid) as temprowid from table a group by a.keyword
) c
where b.rowid=c.temprowid)

where b.rowid in (select c.temprowid from (select a.keyword,count(*) as cout,min(a.rowid) as temprowid from table a group by a.keyword) c)


--简化之后(java代码中用下面来做。提高性能)
update Table b set b.times=(

select count(*) from Table a group by a.keyword

where a.rowid= )

where b.rowid =