pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roberto Spier <roberto.spier@conab.gov.br>
To: Dani CastaƱos <danitao.mailists@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Having the sum of two queries
Date: Mon, 16 Jul 2007 08:57:08 -0300
Message-ID: <469B5D14.4090700@conab.gov.br> (raw)
In-Reply-To: <469B512D.70507@gmail.com>
References: <469B512D.70507@gmail.com>

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...
 





view thread (5+ messages)  latest in thread

Message-ID: <469B5D14.4090700@conab.gov.br>
Permalink:  ../469B5D14.4090700@conab.gov.br/
Also on:    postgresql.org/message-id/469B5D14.4090700@conab.gov.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: roberto.spier@conab.gov.br, danitao.mailists@gmail.com
  Subject: Re: Having the sum of two queries
  In-Reply-To: <469B5D14.4090700@conab.gov.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox