Received: from mail.camgsm.com.kh (mailmx.camgsm.com.kh [203.144.65.11]) by postgresql.org (Postfix) with ESMTP id 1F5DD475D97 for ; Thu, 7 Mar 2002 04:50:01 -0500 (EST) Received: from idlonh ([23.0.160.5]) by mail.camgsm.com.kh (8.12.2/8.12.2) with SMTP id g279Iebs022612 for ; Thu, 7 Mar 2002 16:18:40 +0700 Message-ID: <003801c1c5ba$b06543e0$05a00017@idlonh> From: "Lonh SENG" To: Subject: Coalesce Get Duplicate Record Date: Thu, 7 Mar 2002 16:30:03 +0700 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0034_01C1C5F5.55B2DFD0" 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: 200203/77 X-Sequence-Number: 6958 This is a multi-part message in MIME format. ------=_NextPart_000_0034_01C1C5F5.55B2DFD0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0035_01C1C5F5.55B2DFD0" ------=_NextPart_001_0035_01C1C5F5.55B2DFD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all, I have got the idea of using coalesce from admin list. It's cool. For this moment, I want to know something more you. Why I have got duplication record as shown in the result.txt attached f= ile? The other on is the script I used. Of course, I need some help from you= urgently. Your comment will be gratefully appreciated. Thanks in advance Best Regards, Lonh SENG ------=_NextPart_001_0035_01C1C5F5.55B2DFD0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
 
    I have got the idea of = using=20 coalesce from admin list.
    It's cool.
    For this moment, I want= to know=20 something more you.
    Why I have got duplication r= ecord=20 as shown in the result.txt attached file?
    The other on is the scr= ipt I=20 used. Of course, I need some help from you urgently.
 
    Your comment will be gr= atefully=20 appreciated.
    Thanks in=20 advance
 
Best Regards,
 
Lonh SENG
= ------=_NextPart_001_0035_01C1C5F5.55B2DFD0-- ------=_NextPart_000_0034_01C1C5F5.55B2DFD0 Content-Type: text/plain; name="result.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="result.txt" f1 f2 f2 f3 f4 ENDING_BAL= COST ENDING_BAL1 COST1 INFO IN= FO1=20=20=20=20=20=20 ---------------------------------------------------------------------------= ---------------------------------------------------------------------------= ----------------------------------- a b 2002-03-05 06:11:42.000 2002-03-05 07:38:21.00= 0 14 8.3000 .2000 8.1000 .00= 00 OUTGOING OUTGOING a b 2002-03-05 06:11:42.000 2002-03-05 07:38:21.00= 0 14 8.3000 .2000 NULL NUL= L OUTGOING NULL ------=_NextPart_000_0034_01C1C5F5.55B2DFD0 Content-Type: text/plain; name="script.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="script.txt" insert into Rin_cdr_call_cleaned (f1 , f2 , f3 , f4 , ENDING_BAL , COST,INF= O,inbtime1) select t1.card,t1.phone, t1.inbtime,length,ending_bal, cost,info, coalesce((selec= t min(inbtime) from rin_cdr_call_history t2 where t2.inbtime>t1.inbtime and t2.card=3Dt1.card), t1.inbtime) from rin_cdr_call_history t1 order by 1,2 ------=_NextPart_000_0034_01C1C5F5.55B2DFD0--