Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 18 May 2009 @ 17:29:47 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Local Variables in Macro
 
From:   Dieter Noeth

Hanumath Padarthi wrote:

          > Select * from testdb.emp
          >    where deptno between (select max(deptno) from testdb.dept) and 10

Rewrite it using an explicit join:

     Select * from testdb.emp,
     (select max(deptno) as maxdeptno from testdb.dept) as dt
     where deptno between maxdeptno and 10

or rewrite BETWEEN:

     SELECT * FROM testdb.emp
     WHERE deptno >= (SELECT MAX(deptno) FROM testdb.dept)
     AND deptno <= 10

Dieter



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023