Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Update temp table with alias

$
0
0

I have query like this:

SELECT o1.q_sum, c.q_sum FROM CTE1 c INNER JOIN #order o1 ON o1.col1=c1.col1

It works. I get c.q_sum different from null for every row, while o1.q_sum is null.

But if I write like this:

UPDATE o1 SET o1.q_sum=c.q_sum FROM CTE1 c INNER JOIN #order o1 ON o1.col1=c1.col1

id doesn't work. The all columns q_sum from temp table are still null. How is that possible?



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>