select a from t1 union all select a from t2
123查询方式:
select a from t1 union select a from t2
update语句可以搞定,但是需要join配合,
例如,有个表如下,需要将id =999对应的name改为id=1000对应的name
可以这么做:
update person t1 join (select id,name from person where id = 1000 limit 1 ) as t2 on t1.id <= t2.id set t1.name = t2.name where t1.id = 999 and t2.id = 1000
修改后的结果
这样就可以了。。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)