第一步:先把需要查询的数据列出来
select UUID(), a.Code, a.Name,a.Continent from country a, countrylanguage b where a.Code = b.CountryCode;
注意:UUID()不要分割,分割后,uuid相同
第二步:把数据插入到表中
insert into temptable (id,code,name,continent) (
select UUID(), a.Code, a.Name,a.Continent from country a, countrylanguage b where a.Code = b.CountryCode
);
第三步:更新UUID,将“ - ”替换掉
update TEMPTABLE set id =select REPLACE(id,'-','')
OK,搞定
如对本文有疑问, 点击进行留言回复!!
数据库优化-索引的创建-MySQL-index-SQL优化-避免全表扫描
mysql 获取数据库表所有字段,GROUP_CONCAT()拼接字段缺失问题解决
网友评论