Re: Having the sum of two queries

From: Roberto Spier <roberto(dot)spier(at)conab(dot)gov(dot)br>
To: Dani Castaños <danitao(dot)mailists(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Having the sum of two queries
Date: 2007-07-16 11:57:08
Message-ID: 469B5D14.4090700@conab.gov.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dani Castaños escreveu:

...
>
> And have the result of both added.
>
> I've tried something like
>
> SELECT tot.status, COUNT(total)
Should be

SELECT tot.status, SUM(total)
> FROM( QUERY A UNION QUERY B ) AS tot
> GROUP BY tot.status
>
> But it doesn't works. It doesn't add the total columns with the same
> status...

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitry Turin 2007-07-16 13:18:57 Re: [OBORONA-SPAM] calling webservice through postgresql function
Previous Message Achilleas Mantzios 2007-07-16 11:15:44 Re: Having the sum of two queries