Results 1 to 2 of 2

Thread: How can I display the records in specific format

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Answers
    1

    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


  2. #2
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    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
    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.

    Last edited by Innila; 05-30-2007 at 05:53 AM.
    *** Innila ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact