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

Re: Optimal query suggestion needed

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: InterZone <lists(at)interzone(dot)gr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Optimal query suggestion needed
Date: 2004-06-17 20:01:23
Message-ID: 20040617200123.GA28736@wolff.to (view raw or flat)
Thread:
Lists: pgsql-sql
On Thu, Jun 17, 2004 at 22:22:34 +0300,
  InterZone <lists(at)interzone(dot)gr> wrote:
> 
> Thanks
> the query you sent failed on v. 7.4, so I added an "end" to the case 
> statement. I selected from the tables and the results seem to be correct.

That was an unintentional typo.

> 
> I rewrite it for archiving reasons:
> 
> select t0.code, t0.address, t0.mun, t1.code as t1code, t1.pname
> count(t2.code) as t2total, count(case when t2.avail then 1 else NULL 
> end) as t2avail from t0, t1, t2 where t2.t0_fk = t0.code and 
> t2.t1_fk=t1.code group by t0.code, t0.address, t0.mun, t1.code, t1.pname
> 
> 
> Once again thank you.

Your welcome.

In response to

pgsql-sql by date

Next:From: Jie LiangDate: 2004-06-17 20:54:51
Subject: Re: Prepare Statement
Previous:From: InterZoneDate: 2004-06-17 19:22:34
Subject: Re: Optimal query suggestion needed

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