|
|
Re: UNION ALL with ORDER BY [message #390785 is a reply to message #390783] |
Mon, 09 March 2009 15:27 |
manju_cy
Messages: 10 Registered: February 2009
|
Junior Member |
|
|
Lets say I am doing as shown below
select t1.empno, t1.ename, t1.deptno, t1.hiredate, count(*)
from scott.emp t1
where t1.sal > 1000
group by t1.empno, t1.ename, t1.deptno, t1.hiredate
order by t1.hiredate
union all
select t1.empno, t1.ename, t1.deptno, t1.hiredate, count(*)
from scott.emp t1
where t1.sal > 2000
group by t1.empno, t1.ename, t1.deptno, t1.hiredate
order by t1.hiredate
|
|
|
|
|
|
Re: UNION ALL with ORDER BY [message #390791 is a reply to message #390787] |
Mon, 09 March 2009 15:41 |
manju_cy
Messages: 10 Registered: February 2009
|
Junior Member |
|
|
only once? where? after the first uery or the second query?
Lets say if the order by is on different columns?
select t1.empno, t1.ename, t1.deptno, t1.hiredate, count(*)
from scott.emp t1
where t1.sal > 1000
group by t1.empno, t1.ename, t1.deptno, t1.hiredate
order by t1.hiredate
union all
select t1.empno, t1.ename, t1.deptno, t1.hiredate, count(*)
from scott.emp t1
where t1.sal > 2000
group by t1.empno, t1.ename, t1.deptno, t1.hiredate
order by t1.deptno
|
|
|
|
|
|
Re: UNION ALL with ORDER BY [message #390818 is a reply to message #390782] |
Mon, 09 March 2009 23:12 |
|
Quote: |
Thanks I dont have time to give you all the details I mean test data, expected results..... I will find the solution with some other sites. Thanks aanyway.
|
Strange Demand !!! but still got the solution
Regards,
Ashoka BL
|
|
|