sql 这2个语句能整合成一句吗 mysql
updateall_statusa,customerbseta.buyer_name=b.namewherea.buyer_id=b.buyer_idupdateall_...
update all_status a,customer b set a.buyer_name = b.name where a.buyer_id = b.buyer_id
update all_status a,customer b set a.buyer_name_s = b.name where a.buyer_id_s = b.buyer_id 展开
update all_status a,customer b set a.buyer_name_s = b.name where a.buyer_id_s = b.buyer_id 展开
2个回答
展开全部
--不能合成一句,但是可以建一个存储过程执行这两句
CREATE proc [dbo].[UPDATESQL]
as
update all_status a,customer b set a.buyer_name = b.name where a.buyer_id = b.buyer_id
update all_status a,customer b set a.buyer_name_s = b.name where a.buyer_id_s = b.buyer_id
--以后你直接执行 exec [dbo].[UPDATESQL] 就可以了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询