Received: from dealer.netventures.com.au (dnet137107-1.gw.connect.com.au [210.8.15.221] (may be forged)) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0U28Gl28526 for ; Tue, 29 Jan 2002 21:08:16 -0500 (EST) (envelope-from david@netventures.com.au) Received: from ciderbox.in.netventures.com.au (net137107-2.gw.connect.com.au [210.9.198.119]) by dealer.netventures.com.au (Postfix) with ESMTP id DBC761A5DC5; Wed, 30 Jan 2002 13:08:16 +1100 (EST) Date: Wed, 30 Jan 2002 13:08:23 +1100 Subject: Re: [ADMIN] SQL Script Content-Type: multipart/alternative; boundary=Apple-Mail-1--310434794 Mime-Version: 1.0 (Apple Message framework v480) Cc: "lonh SENG" To: pgsql-sql@postgresql.org From: David Stanaway In-Reply-To: <00ba01c1a92b$31c58280$05a00017@idlonh> Message-Id: <3D4F50BE-1526-11D6-BBC8-0003930FDAB2@netventures.com.au> X-Mailer: Apple Mail (2.480) X-Archive-Number: 200201/328 X-Sequence-Number: 6412 --Apple-Mail-1--310434794 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed On Wednesday, January 30, 2002, at 12:12 PM, lonh SENG wrote: > Hi all, > =A0 > =A0=A0=A0 I have one table containing data as "source.txt" attached file.= I=20 > want to create a script to clean=A0the data and get the result as=20 > "result.txt" attached file. > =A0=A0=A0 inbtime and inbtime1 is datetime data type. > =A0=A0=A0 Anyone has an idea? > =A0=A0=A0 Any help will be appreciated. > =A0=A0=A0 thanks in advance It looks like you are going to need to look into using a cursor, and=20 perl DBI or equiv. Alternatively, you could create a function in=20 PL/PGSQL. Where do you get the date for the end of the interval for the last=20 inbtime ordered by time? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D David Stanaway Personal: david@stanaway.net Work: david@netventures.com.au --Apple-Mail-1--310434794 Content-Transfer-Encoding: quoted-printable Content-Type: text/enriched; charset=ISO-8859-1 On Wednesday, January 30, 2002, at 12:12 PM, lonh SENG wrote: ArialHi all, =A0 Arial=A0=A0=A0 I have one table containing data as "source.txt" attached file. I want to create a script to clean=A0the data and get the result as "result.txt" attached file. =A0=A0=A0 inbtime and inbtime1 is datetime data type. Arial=A0=A0=A0 Anyone has an idea? Arial=A0=A0=A0 Any help will be appreciated. Arial=A0=A0=A0 thanks in advance It looks like you are going to need to look into using a cursor, and perl DBI or equiv. Alternatively, you could create a function in PL/PGSQL. Where do you get the date for the end of the interval for the last inbtime ordered by time? Helvetica=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D David Stanaway Personal: david@stanaway.net=20 Work: david@netventures.com.au --Apple-Mail-1--310434794--