在mysql中,通过一张表的列修改另一张关联表中的内容: 1: 修改1列 update student s, city c set s.city_name = c.name where s.city_code = c.code; 2: 修改多个列 update a, b set a.title=b.title, a.name=b.name where a.id=b.id 3: 采用子查询 update student s set city_name = (select name from c…
update CDINFO.Dept_Dict tab1 set PART_FLAG = (select PART_FLAG from DICT.DEPARTMENT_DICT@zyhis4 tab2 where tab1.dept_code = tab2.dept_code) where exists (select 1 from DICT.DEPARTMENT_DICT@zyhis4 tab2 where tab1.dept_code = tab2.dept_code)…
UPDATE channelcountry, appywproducts SET channelcountry.ChannelName = appywproducts.YWNameCN WHERE channelcountry.ChannelCode = appywproducts.YWCode; 或者 UPDATE channelcountry a SET ChannelName = ( SELECT YWNameCN FROM appywproducts b WHERE a.ChannelC…
知道是两张表进行更新,之前作过mysql的,直接就写了: update a,b set a.code = b.code wehre a.id = b.id 然后就报错了,上网查了下知道oracle不能这样子写 之后找到如下的办法: UPDATE a set a.code = (select b.code from b where a.id = b.id) 但是这条语句如果数据多的话会很慢,因为他要每条数据都要跟新 然后又找到了这条sql: MERGE INTO a USING b ON ( a.…
一.去重 1.查询出重复的记录 CREATE TABLE push_log_full_2013_10_30_tmp SELECT * FROM `push_log_full` WHERE time BETWEEN FROM_DAYS(TO_DAYS(NOW()) - 1) AND FROM_DAYS(TO_DAYS(NOW())) AND (imsi, andriodid, time) IN ( SELECT imsi, andriodid, time FROM `push_log_full`…