How can I display the records in specific format
I have two tables Emp and Dept
Emp columns -- eno,ename,dno
Dept columns -- dno,dname
I would like to display Emp Information like this
eno ename dno
1 m 10
2 n
3 o
4 x 20
5 y
6 a 30
7 b
8 c
m, n and o has same dno. so I want to display the dno 10 only once
x, y -- dno 20
a, b and c -- dno 30
How can I display the records in the above format?
Thanks and Regards
Anand
Re: How can I display the records in specific format
Hi Anand,
Formatting the Query results will satisfy your above format & the query is,
[Code]
break on deptno skip 0
select deptno, empno, ename
from emp
order by deptno
EMPNO ENAME DEPTNO
---------- ---------- ----------
7782 CLARK 10
7839 KING
7934 MILLER
7369 SMITH 20
7876 ADAMS
7902 FORD
7499 ALLEN 30
7698 BLAKE
7654 MARTIN
[/Code]
The skip line_number can be changed to skip the no of lines required. skip 1 will skip one line after the first set of records.
For further more formatting, the heading & pagesize can be modified so that the format represents more elegance.