我想通过一个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