-
Header & Lines SQL
Hi,
I am trying to create data file from SQL, I need file output in the below format (Header & Lines).
10 ACCOUNTING (Header)
CLARK (Line1)
KING (Line2)
MILLER (Line3)
20 RESEARCH (Header)
SMITH (Line1)
JONES (Line2)
SCOTT (Line3)
ADAMS (Line4)
FORD (Line5)
Here is the sql query I have built, but not working properly.
select d.deptno||' '||d.dname||chr(10)||e.ename
from dept d,
emp e
where d.deptno=e.deptno
and d.deptno in (10,20)
order by d.deptno
10 ACCOUNTING (Header need this)
CLARK
10 ACCOUNTING (Header don't want)
KING
10 ACCOUNTING (Header don't want)
MILLER
20 RESEARCH (Header need this)
SMITH
20 RESEARCH (Header don't want)
JONES
20 RESEARCH (Header don't want)
SCOTT
20 RESEARCH (Header don't want)
ADAMS
20 RESEARCH (Header don't want)
FORD
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|