Re: [SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Tarlika Elisabeth Schmitz
On Tue, 8 Feb 2011 18:38:44 - "Oliveiros d'Azevedo Cristina" wrote: >- Original Message - >From: "Tarlika Elisabeth Schmitz" >To: >Sent: Tuesday, February 08, 2011 6:14 PM >Subject: [SQL] data import: 12-hour time w/o AM/PM > > >I am importing data in CSV format. My technique is t

Re: [SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Tarlika Elisabeth Schmitz
On Wed, 9 Feb 2011 08:21:47 +1300 Andrej wrote: >On 9 February 2011 07:14, Tarlika Elisabeth Schmitz > wrote: >> From the date and time I want to create a timestamp. >> I know that >> - the events take place during the day, say between 10:30 and 22:30 >> - it's always a set of events at one locat

Re: [SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Pavel Stehule
2011/2/8 Emi Lu : > On 02/08/2011 02:51 PM, Rolando Edwards wrote: >> >> SELECT distinct c1,array_to_string(array(SELECT c2 FROM T1 B where >> A.c1=B.c1),', ') from T1 A order by c1; >> >> Give it a Try !!! > > > Thanks a lot! Very helpful! > > array_to_string() + array() is exactly what I am looki

Re: [SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Emi Lu
On 02/08/2011 02:51 PM, Rolando Edwards wrote: SELECT distinct c1,array_to_string(array(SELECT c2 FROM T1 B where A.c1=B.c1),', ') from T1 A order by c1; Give it a Try !!! Thanks a lot! Very helpful! array_to_string() + array() is exactly what I am looking for! I just wonder that array_to_

Re: [SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Peter Steinheuser
I'm not saying this is good or best but: select distinct a.c1, array_to_string(array(select c2 from t1 as b where b.c1 = a.c1),',') from t1 as a; c1 | array_to_string +- 1 | val1,val2,val3 2 | val1 3 | val5,val6 (3 rows) On Tue, Feb 8, 2011 at 2:35 PM, Emi Lu wro

Re: [SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Rolando Edwards
SELECT distinct c1,array_to_string(array(SELECT c2 FROM T1 B where A.c1=B.c1),', ') from T1 A order by c1; Give it a Try !!! Rolando A. Edwards MySQL DBA (SCMDBA) 155 Avenue of the Americas, Fifth Floor New York, NY 10013 212-625-5307 (Work) 201-660-3221 (Cell) AIM & Skype : RolandoLogicWorx re

Re: [SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Pavel Stehule
Hello you can use a string%agg function if you have a 9.0. On older version there is a array_agg function select c1, array_to_string(array_agg(c2),',') from T1 group by c1 regards Pavel Stehule 2011/2/8 Emi Lu : > Good afternoon, > > Is there a method to retrieve the following results: > > T1(

[SQL] "select c1, method(c2) group by c1" returns all values of c2 for c1

2011-02-08 Thread Emi Lu
Good afternoon, Is there a method to retrieve the following results: T1(c1 int, c2 varchar(128) ) - (1, val1); (1, val2); (1, val3); (2, val1); (3, val5); (3, val6); select c1, method(c2) group by c1 returns: 1, "val1, val2, val3" 2, "val1" 3,

Re: [SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Andrej
On 9 February 2011 07:14, Tarlika Elisabeth Schmitz wrote: > From the date and time I want to create a timestamp. > I know that > - the events take place during the day, say between 10:30 and 22:30 > - it's always a set of events at one location spaced about 30min apart > - the imported data are c

Re: [SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Leif Biberg Kristensen
On Tuesday 8. February 2011 19.14.00 Tarlika Elisabeth Schmitz wrote: > From the date and time I want to create a timestamp. > I know that > - the events take place during the day, say between 10:30 and 22:30 > - it's always a set of events at one location spaced about 30min apart > - the imported

Re: [SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Oliveiros d'Azevedo Cristina
Howdy, Tarlika. If the data doesn't bring the AM/PM how are you supposed to distinguish between,say, 10pm and 10am ? Does it always start at 10:30am? So 10am never arises? Best, Oliveiros - Original Message - From: "Tarlika Elisabeth Schmitz" To: Sent: Tuesday, February 08, 2011

[SQL] data import: 12-hour time w/o AM/PM

2011-02-08 Thread Tarlika Elisabeth Schmitz
I am importing data in CSV format. My technique is to COPY the data into interim tables (starting with a "z") where I analyze them, clean up inconsistencies; eventually I will populate the "proper" tables with these data. (In the example below: COPY CSV into zevent, from there populate event.) The

Re: [SQL] Cumulative result with increment

2011-02-08 Thread Shawn Tayler
Thanks Steve, That did the trick! I appreciate the help Shawn On Mon, 2011-02-07 at 14:13 -0800, Steve Crawford wrote: > On 02/07/2011 01:11 PM, Shawn Tayler wrote: > > Hello, > > > > I am struggling with what is probably a simple problem but I am coming > > up blank. In the interest of f

Re: [SQL] Get postgresql server ip address

2011-02-08 Thread Chris Browne
gerame...@gmail.com (Gera Mel Handumon) writes: > Is it possible to get postgresql server ip address using sql command? You can get the IP address tied to a specific connection... See the function inet_server_port(). Note, however, that the server may have a multiplicity of IP addresses, so th

Re: [SQL] Get postgresql server ip address

2011-02-08 Thread Dmitriy Igrishin
2011/2/8 Gera Mel Handumon > Hello, > > Is it possible to get postgresql server ip address using sql command? > Oh yes, use inet_server_addr() function. Please note, that NULL is returned if connection established via socket. > > TIA, > > Geramel > > > ---

[SQL] Get postgresql server ip address

2011-02-08 Thread Gera Mel Handumon
Hello, Is it possible to get postgresql server ip address using sql command? TIA, Geramel - "Share your knowledge. It's a way to achieve immortality" - Dalai Lama -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

Re: [SQL] UTF characters compromising data import.

2011-02-08 Thread Pavel Stehule
Hello 2011/2/8 Gavin Beau Baumanis : > Hi Everyone, > > I am trying to import some data (provided to us from an external source) from > a CSV file using "\copy " > > But I get the following error message; > invalid byte sequence for encoding "UTF8": 0xfd > HINT:  This error can also happen if

[SQL] UTF characters compromising data import.

2011-02-08 Thread Gavin Beau Baumanis
Hi Everyone, I am trying to import some data (provided to us from an external source) from a CSV file using "\copy " But I get the following error message; invalid byte sequence for encoding "UTF8": 0xfd HINT: This error can also happen if the byte sequence does not match the encoding expe