Geeks Talk

Prepare for your Next Interview




How can I display the records in specific format

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


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-13-2007
Junior Member
 
Join Date: Jan 2007
Location: Hyderabad
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
anandreddy.bv is on a distinguished road
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
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-30-2007
Expert Member
 
Join Date: Sep 2006
Location: India
Posts: 131
Thanks: 1
Thanked 20 Times in 20 Posts
Innila is on a distinguished road
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.
__________________
*** Innila ***

Last edited by Innila : 05-30-2007 at 06:53 AM.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

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


All times are GMT -4. The time now is 01:16 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved