Re: [SQL] Question on partitioning

2008-08-22 Thread s . caillet
Hi Christina, Quoting Oliveiros Cristina [EMAIL PROTECTED]: Hello , All. I am not sure if this is the right mailing list to place this question. If it doesn't, please kindly redirect me to the right list. I have a giant table with about 10,6 million records. Queries on it are usually

[SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field -- 1 2 3 select concat_something(my_field) from my_table group by something; the result expected would be someting like that : 1/2/3 (with

Re: [SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
any explanations ? On Fri, Aug 22, 2008 at 6:07 PM, Julien Cigar [EMAIL PROTECTED] wrote: array_accum ? On Fri, 2008-08-22 at 15:40 +0200, Nacef LABIDI wrote: Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string.

Re: [SQL] Concat field result in select query

2008-08-22 Thread Julien Cigar
array_accum ? On Fri, 2008-08-22 at 15:40 +0200, Nacef LABIDI wrote: Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field -- 1 2 3 select concat_something(my_field) from

Re: [SQL] Concat field result in select query

2008-08-22 Thread Guillaume Lelarge
Nacef LABIDI a écrit : Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field -- 1 2 3 select concat_something(my_field) from my_table group by something; the result expected

Re: [SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
Thank you, this is all what I need On Fri, Aug 22, 2008 at 4:10 PM, Guillaume Lelarge [EMAIL PROTECTED]wrote: Nacef LABIDI a écrit : Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field

Re: [SQL] Concat field result in select query

2008-08-22 Thread Julien Cigar
Also, the array_accum aggregate isn't present by default, you need to create it with : CREATE AGGREGATE array_accum (anyelement) ( sfunc = array_append, stype = anyarray, initcond = '{}' ); On Fri, 2008-08-22 at 18:24 +0200, Julien Cigar wrote: of course:

Re: [SQL] Concat field result in select query

2008-08-22 Thread Julien Cigar
of course: http://rafb.net/p/EOaYfO59.html Julien On Fri, 2008-08-22 at 15:58 +0200, Nacef LABIDI wrote: any explanations ? On Fri, Aug 22, 2008 at 6:07 PM, Julien Cigar [EMAIL PROTECTED] wrote: array_accum ? On Fri, 2008-08-22 at 15:40 +0200, Nacef

Re: [SQL] Concat field result in select query

2008-08-22 Thread Lennin Caro
Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field -- 1 2 3 select concat_something(my_field) from my_table group by something; the result expected would be someting like

Re: [SQL] Re: Efficiently determining the number of bits set in the contents of, a VARBIT field

2008-08-22 Thread Allan Kamau
All was well with the code below, apologies to all who read my previous email. The error (an oversight) was on my part. In the CREATE FUNCTION ... statement I had FLOAT as the return type instead of INTEGER. Now the function runs smoothly. Preliminary results show it is orders of magnitude

[SQL] Why *no* ambig·uous complain in select part?

2008-08-22 Thread Emi Lu
Good morning, Just notice one small thing, and need your information about select select col1, col2 from table1 left join table2 using (col1, col2) ; This query never complain about ambiguous columns of col1 and col2 in the select part. My guess is: (1) col1, col2 always return

[SQL] RE: [SQL] Why *no* ambig.uous complain in select part?

2008-08-22 Thread Edward W. Rouse
Just a guess, but it seems to me that since the join is using col1 and col2 there is no ambiguity. They should be the same no matter which table it comes from. Edward W. Rouse -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Emi Lu Sent: Friday, August

Re: [SQL] RE: [SQL] Why *no* ambig.uous complain in select part?

2008-08-22 Thread Emi Lu
Hi Edward, Just a guess, but it seems to me that since the join is using col1 and col2 there is no ambiguity. They should be the same no matter which table it comes from. Not always the same; Left join may return: table2.col1,col2 = null, while table1.col1,col2 is not null -Original

Re: [SQL] RE: [SQL] Why *no* ambig.uous complain in select part?

2008-08-22 Thread Emi Lu
Hi Luigi, you will have problems if table 1 and table 2 have the same names to col1 e col2. For example, table1 has col1=parcel and col2=area and table 2 has col1=country and col2=area then, in that case you will have ambiguity. Would you please give me an example? I have two tables like the

Re: [SQL] RE: [SQL] Why *no* ambig.uous complain in select part?

2008-08-22 Thread Mark Roberts
On Fri, 2008-08-22 at 17:10 -0400, Emi Lu wrote: Would you please give me an example? I have two tables like the following: T1 (col1 varchar, col2 varchar, primary key (col1, col2)) T2 (col1 varchar, col2 varchar, primary key (col1, col2)) Query I have is: ===

Re: [SQL] Why *no* ambig·uous complain in select part?

2008-08-22 Thread Tom Lane
Emi Lu [EMAIL PROTECTED] writes: Just notice one small thing, and need your information about select select col1, col2 from table1 left join table2 using (col1, col2) ; This query never complain about ambiguous columns of col1 and col2 in the select part. That's because you used USING,

[SQL] What is wrong with this PostgreSQL UPDATE statement??

2008-08-22 Thread Steve Johnson
Sorry for the fairly long post. I'm having a big problem trying to update one table from another in PostgreSQL 8.3.1. I have a lookup table called termgroup: # select * from termgroup; termgroupname | mindays | maxdays ---+-+- 1-30 days | 1 | 30 31-59

Re: [SQL] What is wrong with this PostgreSQL UPDATE statement??

2008-08-22 Thread Stephan Szabo
On Fri, 22 Aug 2008, Steve Johnson wrote: update certgroups set termgroupname = tg.termgroupname from certgroups c, termgroup tg where (c.days = tg.mindays) and (c.days = tg.maxdays); In recent PostgreSQL versions I believe this is properly written: update certgroups c set termgroupname =

Re: [SQL] What is wrong with this PostgreSQL UPDATE statement??

2008-08-22 Thread Tom Lane
Stephan Szabo [EMAIL PROTECTED] writes: On Fri, 22 Aug 2008, Steve Johnson wrote: update certgroups set termgroupname = tg.termgroupname from certgroups c, termgroup tg where (c.days = tg.mindays) and (c.days = tg.maxdays); In recent PostgreSQL versions I believe this is properly written: