我想通过一个with语句生成个临时表a,再通过a的数据来更新物理表b的数据,但是写的时候总报错,例如:
参考: http://www.itpub.net/thread-1504941-1-1.html
with tablea as
(
select * from teable
)
update b set b.col2=(select a.col2 from tablea a where a.col1=b.col1)但是运行时报错,请教大神该如何改写
=============================================================================
with只能紧跟select使用
update b set b.col2=(
with tablea as
(
select * from teable
)
select a.col2 from tablea a where a.col1=b.col1
)参考: http://www.itpub.net/thread-1504941-1-1.html
本文详细介绍了如何通过正确的语法结构,使用with语句生成临时表并将其用于更新物理表的数据,避免了常见的SQL错误。通过实例演示了改进后的SQL语句,并提供了相关链接以供深入学习。
3487

被折叠的 条评论
为什么被折叠?



