Controlling order of evaluation?

From: Jerry LeVan <jerry(dot)levan(at)eku(dot)edu>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Controlling order of evaluation?
Date: 2004-09-28 22:16:37
Message-ID: 10D50E6D-119C-11D9-B3A8-000393779D9C@eku.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have an srf sql function "annual_report(<year>)" that
as 14 columns, a category, 12 month numeric columns, and a total
numeric column.

The function finds monthly totals for each category (which is the
target of "order by")
and the grand total for the specified year.

I have another sql function annual_profit_loss(<year>) that summarizes
the total
for each month and the grand total for each year. ( There is a text
column that
serves a label.) It generates a summary for the annual_report function
in essence.

I have hoped that

select * from annual_report(2003)
union
select * from annual_profit_loss(2003)

would print the last select last ;( but it inserts the last selection
alphabetically into the rows of the annual_report depending on the label
field... I suppose I could use a label "zzGrand Totals", but that just
does not look right.

Is there any way I can force the last select to appear last?

Jerry

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ed L. 2004-09-28 22:25:41 Re: Pgsql 7.4/8.0 on IA64 HP-UX 11i?
Previous Message Scrappy 2004-09-28 22:05:57 Re: Hello