Prepare for your Next Interview
This is a discussion on How can I display the records in specific format within the SQL forums, part of the Databases category; 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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
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 |
| Sponsored Links |
|
|||
|
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
For further more formatting, the heading & pagesize can be modified so that the format represents more elegance.
__________________
*** Innila *** Last edited by Innila : 05-30-2007 at 06:53 AM. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple checkboxes of same object name; I need to click a specific. How do I go abt | arnoldrocks | Rational Robot | 2 | 08-29-2008 06:36 AM |
| Unable to start the specific test. | JobHelper | QTP | 1 | 06-23-2008 04:03 PM |
| Display n-1 rows from a table | dbtester | SQL Server | 3 | 02-07-2008 08:11 AM |
| which one is best to display records? | psuresh1982 | SQL | 2 | 05-11-2007 10:47 AM |
| How to display following matrix? | orlando | SQL | 4 | 03-13-2007 03:53 AM |