Re: Question About Aggregate Functions - Mailing list pgsql-novice

From Oscar Rodriguez Fonseca
Subject Re: Question About Aggregate Functions
Date
Msg-id 1158146512.6056.52.camel@vrlap.localvrnet
Whole thread Raw
In response to Question About Aggregate Functions  ("Don Parris" <parrisdc@gmail.com>)
List pgsql-novice
El mié, 13-09-2006 a las 13:16 +0200, Oscar Rodriguez Fonseca escribió:

> A query (UNTESTED) that should solve your problem may be this one:
>
> SELECT     a.count AS "t1fielda",
>     b.count AS "t2fielda",
>     c.count AS "t2fieldb",
>     d.avg AS "t2avgc"
> FROM    (SELECT count(*) FROM t1 WHERE fielda = TRUE) AS a
> JOIN    (SELECT count(*) FROM t2 WHERE fielda = TRUE) AS b ON TRUE
> JOIN    (SELECT count(*) FROM t2 WHERE fieldb = TRUE) AS c ON TRUE
> JOIN     (SELECT avg(fieldc) FROM t2) AS d ON TRUE;
>
> I am also a DB novice so this is correct.

Sorry, I was trying to write:

"I am also a DB novice so I HOPE this is correct".

Best regards.



pgsql-novice by date:

Previous
From: Q Beukes
Date:
Subject: pg_dump password
Next
From: Oscar Rodriguez Fonseca
Date:
Subject: Re: Question About Aggregate Functions