On Wednesday 20 December 2006 18:06, Hector Villarreal wrote:
> HI in reading this is it possible what was really intended :
> Sum(case when o_model = 5 then 1 else NULL end) as KA
> That would provide a count of all records meeting that condition.
> Otherwise the count( approach will not do that.
:[EMAIL PROTECTED] On Behalf Of Gary Stainburn
Sent: Wednesday, December 20, 2006 8:20 AM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] join/group/count query.
>
> And, I may be missing something, but I'm having a hard time
> understanding why you have all of those select columns
Gary Stainburn wrote:
And, I may be missing something, but I'm having a hard time
understanding why you have all of those select columns of the form:
count (case when o_model = 5 then 1 else NULL end) as KA,
Considering that that can only return 1 or 0, the case statement would do.
Is it to
>
> And, I may be missing something, but I'm having a hard time
> understanding why you have all of those select columns of the form:
>
> count (case when o_model = 5 then 1 else NULL end) as KA,
>
> Considering that that can only return 1 or 0, the case statement would do.
> Is it to avoid putt
Ragnar wrote:
On mið, 2006-12-20 at 10:12 +, Gary Stainburn wrote:
Hi folks. I have the following query which works for me at the moment.
However, o_model refers to a table stock_models which has one record for each
model type. At the moment if I another record to the stock_models I ha
On mið, 2006-12-20 at 10:12 +, Gary Stainburn wrote:
> Hi folks. I have the following query which works for me at the moment.
> However, o_model refers to a table stock_models which has one record for each
> model type. At the moment if I another record to the stock_models I have to
> amen
Hi folks. I have the following query which works for me at the moment.
However, o_model refers to a table stock_models which has one record for each
model type. At the moment if I another record to the stock_models I have to
amend the select. Is it possible to make this automatic by joining t