| From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Get different sums from the same table in one query |
| Date: | 2007-10-08 11:59:06 |
| Message-ID: | 20071008115906.GD15336@a-kretschmer.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
am Mon, dem 08.10.2007, um 12:32:55 +0100 mailte Peter Childs folgendes:
>
>
> On 08/10/2007, A. Kretschmer <andreas(dot)kretschmer(at)schollglas(dot)com> wrote:
>
> am Mon, dem 08.10.2007, um 12:49:04 +0200 mailte Dani Castaños folgendes:
> > Hi all!
> >
> > I want to put this three queries in only one... Take a look that the
> > only thing that changes is the message_type_id. Any suggestions??
>
> Yes, no problem, You can use UNION (ALL) for such.
>
>
>
> Not sure thats what he wants at all. Anyway Union all is going to produce a
> very slow way of doing this needing to go back to the data 3 times where as
> this only goes once.
Right, conditional statements are a proper solution for this.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rodrigo De León | 2007-10-08 14:46:40 | Re: UNIQUEness and time interval |
| Previous Message | Richard Huxton | 2007-10-08 11:37:09 | Re: Get different sums from the same table in one query |