Re: [SQL] join/group/count query.

2006-12-20 Thread Hector Villarreal
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. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: [SQL] join/group/count query.

2006-12-20 Thread Erik Jones
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

Re: [SQL] join/group/count query.

2006-12-20 Thread Gary Stainburn
> > 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

Re: [SQL] join/group/count query.

2006-12-20 Thread Erik Jones
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

Re: [SQL] Help with quotes in plpgsql

2006-12-20 Thread Richard Huxton
Richard Ray wrote: It makes sense when ya'll explain it It never sounds that good when I'm talkin to myself That solves my problem but not my ignorance I'm still curious about how would I properly quote create or replace function test(integer) returns setof text as $$ declare a record; begin

Re: [SQL] Help with quotes in plpgsql

2006-12-20 Thread Richard Ray
It makes sense when ya'll explain it It never sounds that good when I'm talkin to myself That solves my problem but not my ignorance I'm still curious about how would I properly quote create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now()

Re: [SQL] join/group/count query.

2006-12-20 Thread Ragnar
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

[SQL] join/group/count query.

2006-12-20 Thread Gary Stainburn
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

Re: [SQL] Fetching BLOBs

2006-12-20 Thread Ragnar
On mið, 2006-12-20 at 08:55 +0530, Ashish Ahlawat wrote: > I have a very intersting question to all of you. Pls help me to build > this query, I want to fetch more that 70,000 BLOB from different > customer servers. the issue is there are some BOLB files with common > names on all servers. So I wa