Re: SQLPLUS Tricky Question...Where are the SQL Gurus ??

From: kbarnes <kbarnes_at_iadfw.net>
Date: 1995/08/05
Message-ID: <3vuolp$cqr_at_news.iadfw.net>#1/1


Peter van der Kooi <kooi_at_telecom.ptt.nl> wrote:
>

> Darryl Snedeker x52168 <dsnedeke> wrote:
> >break on report;
> >compute sum of salary on report;
> >
> >select deptno, employee_name, salary
> >from emp
> >order by deptno, employee_name;
> >
> >The above script, as you know, will produce a listing of all employees and will
> >order by department number. For each department, a sum of salaries will be
> >computed. The string 'Sum ' will appear on the same line as each total.
> >
> >How do I change this string 'Sum' to appear as another literal string. I am
> >fairly certain I have seen this worked out before, but is has been 3-4 years
> >and
> >I cannot find the notes I once had.
> >
> >Please don't respond by saying this can't be done, I've already heard from your
> >premier representative.
> >
>
> You can alias the column saying:
>
> select
> deptno "Department Number"
> ,emp "Employee"
> from
> emp
>
> Or by giving the column a format:
>
> column DepartmentNumber format a20
> column Employee format a15
>
> select
> deptno DepartmentNumber
> ,emp Employee
> from
> emp
>
>
>
>
> Peter van der Kooi
> Master DBA
>
Yes you can alias a column, but what he wants is the word 'sum' from the break command to have a different title. I am not sure how this can (if it can) be accomplished. I havenot seen it done.

dept	name	salary
1	bob	5,000

sum		5,0000

^^^^

He wants this to be "Employee Total Salary" -- or some such.

Kevin Received on Sat Aug 05 1995 - 00:00:00 CEST

Original text of this message