2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录
delete from people
where peopleName in (select peopleName from people group by peopleName having count(peopleName) > 1)
and peopleId not in (select min(peopleId) from people group by peopleName having count(peopleName)>1)
3delete from "POEMID_9.25"
where id in (select id
from "POEMID_9.25" group by id having count(id) > 1)
and peopleId not in (select min(peopleId) from "POEMID_9.25" group by id having count(id
)>1)
使用REPLACE更新某表中某个字段详细内容
update 表名 set 字段名 =replace(字段名, ‘查找的内容’,’更改的内容’) where 字段名 like ‘%查找的内容%’;
update shangpin set click_url=replace(click_url,’21508360’,’1111111111’) where click_url like ‘%21508360%’;
两个表中找出不同的数据
select DSLPoemAllData.idnew from DSLPoemAllData left join NEWPOEMID on DSLPoemAllData.idnew=NEWPOEMID.idnew where NEWPOEMID.idnew is null
union select NEWPOEMID.idnew from NEWPOEMID left join DSLPoemAllData on DSLPoemAllData.idnew=NEWPOEMID.idnew where DSLPoemAllData.idnew is null
sql将一个表的数据更新到另外一个表中
UPDATE POEM_Author_Detail
SET dynasty = (SELECT chaodai FROM POEM_Author_ID
WHERE POEM_Author_ID.shiRenID=POEM_Author_Detail.shiRen_idnew)