Skip site navigation (1) Skip section navigation (2)

Re: Question About Aggregate Functions

From: Oscar Rodriguez Fonseca <info(at)vraniscci(dot)com>
To: Don Parris <parrisdc(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Question About Aggregate Functions
Date: 2006-09-13 11:21:52
Message-ID: 1158146512.6056.52.camel@vrlap.localvrnet (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-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.



In response to

pgsql-novice by date

Next:From: Sean DavisDate: 2006-09-13 11:40:19
Subject: Re: pg_dump password
Previous:From: Oscar Rodriguez FonsecaDate: 2006-09-13 11:16:42
Subject: Re: Question About Aggregate Functions

pgsql-general by date

Next:From: Brandon AikenDate: 2006-09-13 13:00:56
Subject: Re: [NOVICE] INSERT does not finish except if it is carried out a
Previous:From: Oscar Rodriguez FonsecaDate: 2006-09-13 11:16:42
Subject: Re: Question About Aggregate Functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group