Archives of the TeradataForum
Message Posted: Mon, 18 May 2009 @ 17:29:47 GMT
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
|