Re: SQL select question
Date: Thu, 10 Dec 1998 09:16:45 +0000
Message-ID: <366F917D.6C6C_at_eurocontrol.be>
Wim Jans wrote:
>
> Hi,
>
> Try this
>
> SQL> break on deptno skip 1
> SQL> select *
> from emp
> order by deptno
>
Try to put the column you use as break column (in this case deptno) as the first column: It looks better. (but you can't use 'select *' unless it is the first column you want to break on.)
IMPORTANT: do not forget to execute a 'break off' after the select! Otherwise it remains active and will affect any select with a deptno column...
SQL> SQL> break on deptno skip 1 SQL> select deptno, empno, ename
2 from emp
3 order by deptno;
DEPTNO EMPNO ENAME
---------- ---------- ----------
10 7782 CLARK 7839 KING 7934 MILLER 20 7369 SMITH 7876 ADAMS 7902 FORD 7788 SCOTT 7566 JONES 30 7499 ALLEN 7698 BLAKE 7654 MARTIN 7900 JAMES 7844 TURNER 7521 WARD
14 rows selected.
SQL> clear breaks
breaks cleared
SQL>
> dennishancy_at_eaton.com wrote in message <74m7gr$95l$1_at_nnrp1.dejanews.com>...
> >I'm hoping this will be a simple SQL question to answer.
> >
> >I have a table with very few columns. I want to print each of the fields
> in
> >this table, which I know will be a simple "select * from TABLE" command.
> >
> >Ok, but I want to modify the output slightly. I think I need a "group by"
> or
> >"break on" clause, but I'm not sure. I'd like to have each group of
> records
> >having the same value for "field1" print together. In other words, having
> a
> >blank line in between each group is my goal.
> >
> >Can anyone shed some light on this for someone who doesn't use SQL that
> much?
> >Thanks.
> >
> >
> >Dennis Hancy
> >Eaton Corporation
> >Cleveland, OH
> >
> >-----------== Posted via Deja News, The Discussion Network ==----------
> >http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Thu Dec 10 1998 - 10:16:45 CET