从一表中多条件update到另一个表
UPDATE a, b
SET a.id = b.id,a.name = b.name
WHERE
a.xx = b.xx
AND a.xxx = b.xxx
找出重复行
select name,count(name) from a where parent_id = 0 group by name HAVING count(name) > 1
查询结果新建表
create table a
select 。。。。
UPDATE a, b
SET a.id = b.id,a.name = b.name
WHERE
a.xx = b.xx
AND a.xxx = b.xxx
select name,count(name) from a where parent_id = 0 group by name HAVING count(name) > 1
create table a
select 。。。。
本文标题:SQL常遇到的问题
本文链接:https://www.haomeiwen.com/subject/ttddaqtx.html
网友评论