|
|
Archives of the TeradataForum
Message Posted: Tue, 19 Dec 2006 @ 17:04:41 GMT
Subj: | | Re: Group by of multiple columns for teradata and |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Tuesday, December 19, 2006 12:01 -->
Simple rule: If you want the result set ordered in a particular way, you have to say so with an ORDER BY clause. In some other databases
results happen to consistently be returned in a particular default order, but the SQL standard does not require that. Not only is the default
order independent of the GROUP BY, but due to Teradata's asynchronous parallel processing it may well be different on one execution than the
next.
select deptno, mgrno, empno from master
where <<>>>
group by deptno, mgrno,empno
ORDER BY DEPTNO, MGRNO, EMPNO; -- or ORDER BY 1, 2, 3;
| |