开发者

Output clause with left join, how to?

Is it possible to do something along those lines:

DELETE TOP开发者_开发知识库(1) m
FROM MyTable m
OUTPUT deleted.*
LEFT JOIN MyOtherTable ON MyOtherTable.SomeColumn=s.SomeColumn

I know this works:

DELETE TOP(1) 
FROM MyTable
OUTPUT deleted.*

And this also works (although pointless):

DELETE TOP(1) m 
FROM MyTable m
LEFT JOIN MyOtherTable ON m.SomeColumn=MyOtherTable.SomeColumn


Move the OUTPUT clause to before the JOIN

DELETE TOP(1) m 
OUTPUT deleted.* 
FROM MyTable m 
LEFT JOIN MyOtherTable ON MyOtherTable.SomeColumn=s.SomeColumn 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜