Received: from mailmx.camgsm.com.kh (mailmx.camgsm.com.kh [203.144.65.11]) by postgresql.org (8.11.3/8.11.4) with ESMTP id g0U40ul50798 for ; Tue, 29 Jan 2002 23:00:58 -0500 (EST) (envelope-from slonh@camgsm.com.kh) Received: from idlonh ([23.0.160.5]) by mailmx.camgsm.com.kh (8.10.2/8.10.2/SuSE Linux 8.10.0-0.3) with SMTP id g0U3c6P09953; Wed, 30 Jan 2002 10:38:06 +0700 X-Authentication-Warning: mailmx.camgsm.com.kh: Host [23.0.160.5] claimed to be idlonh Message-ID: <002001c1a93f$79369aa0$05a00017@idlonh> From: "lonh SENG" To: "Stephan Szabo" Cc: References: <20020129180955.B97423-100000@megazone23.bigpanda.com> Subject: Re: SQL Script Date: Wed, 30 Jan 2002 10:37:41 +0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200201/254 X-Sequence-Number: 3135 Thank all of you very much. It works now. ----- Original Message ----- From: "Stephan Szabo" To: "lonh SENG" Cc: Sent: Wednesday, January 30, 2002 9:14 AM Subject: Re: [ADMIN] SQL Script > > On Wed, 30 Jan 2002, lonh SENG wrote: > > > Hi all, > > > > I have one table containing data as "source.txt" attached file. I > > want to create a script to clean the data and get the result as > > "result.txt" attached file. > > inbtime and inbtime1 is datetime data type. > > Anyone has an idea? > > Any help will be appreciated. > > thanks in advance > > > > Sorry. It seems to be out of the topic. > > Probably belongs on pgsql-sql, but... :) > > This is not at all optimized, but maybe something of the form: > > select t1.card, t1.inbtime, coalesce((select min(inbtime) from t t2 where > t2.inbtime>t1.inbtime and t2.card=t1.card), t1.inbtime) from t t1; > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > >