Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Teradata 12 and Subqueries - response (9) by dnoeth

$
0
0

I'm not a Teradata developer, but all DBMSes have severe problems rewriting Correlated Scalar Subqueries, that's why i always try to avoid them :-)
In your case i would a 3rd query, it's the easiest way to convert a scalar aggregate to a join:

Query 3:
sel a1,b1, totalamount
from    t1 left join 
 (select  a2,  sum(c2) as totalamount 
  from    t2
  group by 1
 ) as dt
on     a2=a1;

Btw, your Q2 should use an Outer Join, too, otherwise the result might be different.


Viewing all articles
Browse latest Browse all 27759

Trending Articles



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