<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Delete Records in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066081#M904876</link>
    <description>For reference...File Attached&lt;BR /&gt;&lt;BR /&gt;For the combination Loan_Lease||Prod_short||act_num&lt;BR /&gt;i have 2 customers. I want delete either one of the the customer.&lt;BR /&gt;&lt;BR /&gt;How the delete statement should be ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
    <pubDate>Mon, 08 Sep 2003 16:22:58 GMT</pubDate>
    <dc:creator>Prabhu_7</dc:creator>
    <dc:date>2003-09-08T16:22:58Z</dc:date>
    <item>
      <title>Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066081#M904876</link>
      <description>For reference...File Attached&lt;BR /&gt;&lt;BR /&gt;For the combination Loan_Lease||Prod_short||act_num&lt;BR /&gt;i have 2 customers. I want delete either one of the the customer.&lt;BR /&gt;&lt;BR /&gt;How the delete statement should be ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Sep 2003 16:22:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066081#M904876</guid>
      <dc:creator>Prabhu_7</dc:creator>
      <dc:date>2003-09-08T16:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066082#M904877</link>
      <description>Your file is unreadable by word.  Can you upload it with notepad instead?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Mon, 08 Sep 2003 19:10:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066082#M904877</guid>
      <dc:creator>Brian Crabtree</dc:creator>
      <dc:date>2003-09-08T19:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066083#M904878</link>
      <description>For combination of Loan_Lease||Prod_short||act_num &lt;BR /&gt;i have two or more customers.&lt;BR /&gt;I want to keep only one customer and delete &lt;BR /&gt;others for this combination.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Select cus_num, Loan_Lease,Prod_short,act_num&lt;BR /&gt; from bts_caf_file where Loan_Lease||Prod_short||act_num in (&lt;BR /&gt;select Loan_Lease||Prod_short||act_num&lt;BR /&gt;from bts_caf_file where status is null &lt;BR /&gt;group by   Loan_Lease||Prod_short||act_num&lt;BR /&gt;having count(*) &amp;gt; 1&lt;BR /&gt;)&lt;BR /&gt;order by Loan_Lease||Prod_short||act_num&lt;BR /&gt;&lt;BR /&gt;Sample Data&lt;BR /&gt;&lt;BR /&gt;Cusnum Loan_Lease Prodshort Act_Num&lt;BR /&gt;&lt;BR /&gt;00001 AM    CRD         1000&lt;BR /&gt;00002 AM    CRD  1000&lt;BR /&gt;&lt;BR /&gt;00003 AM   CRD  2000&lt;BR /&gt;00004 AM CRD  2000&lt;BR /&gt;00008 AM CRD  2000&lt;BR /&gt;00005 AM CRD          2000&lt;BR /&gt;&lt;BR /&gt;00006 AM CRD  3000&lt;BR /&gt;00009 AM CRD          3000&lt;BR /&gt;00010 AM CRD  3000&lt;BR /&gt;&lt;BR /&gt;Output should be&lt;BR /&gt;&lt;BR /&gt;Cusnum Loan_Lease Prodshort Act_Num&lt;BR /&gt;&lt;BR /&gt;00001 AM   CRD  1000&lt;BR /&gt;00003 AM CRD  2000&lt;BR /&gt;00006 AM CRD  3000&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 08 Sep 2003 19:25:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066083#M904878</guid>
      <dc:creator>Prabhu_7</dc:creator>
      <dc:date>2003-09-08T19:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066084#M904879</link>
      <description>Select cus_num, Loan_Lease,Prod_short,act_num &lt;BR /&gt;from bts_caf_file where Loan_Lease||Prod_short||act_num in ( &lt;BR /&gt;select Loan_Lease||Prod_short||act_num &lt;BR /&gt;from bts_caf_file where status is null &lt;BR /&gt;group by Loan_Lease||Prod_short||act_num &lt;BR /&gt;having count(*) &amp;gt; 1 &lt;BR /&gt;) &lt;BR /&gt;and cus_num in (select min(cus_num) from bts_caf_file group by loan_lease||prod_short||act_num)&lt;BR /&gt;order by Loan_Lease||Prod_short||act_num &lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Mon, 08 Sep 2003 20:03:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066084#M904879</guid>
      <dc:creator>Brian Crabtree</dc:creator>
      <dc:date>2003-09-08T20:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066085#M904880</link>
      <description>The following is modifed version of brian's SQL that will delete the duplicates&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;delete from bts_caf_file where &lt;BR /&gt;cus_num||Loan_Lease||Prod_short||act_num not in&lt;BR /&gt;(Select cus_num||Loan_Lease||Prod_short||act_num from bts_caf_file where Loan_Lease||Prod_short||act_num in ( &lt;BR /&gt;select Loan_Lease||Prod_short||act_num &lt;BR /&gt;from bts_caf_file where status is null &lt;BR /&gt;group by Loan_Lease||Prod_short||act_num &lt;BR /&gt;having count(*) &amp;gt; 1 &lt;BR /&gt;) &lt;BR /&gt;and cus_num in (select min(cus_num) from bts_caf_file group by loan_lease||prod_short||act_num) &lt;BR /&gt;order by Loan_Lease||Prod_short||act_num )&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Sep 2003 14:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066085#M904880</guid>
      <dc:creator>John Jayaseelan</dc:creator>
      <dc:date>2003-09-12T14:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066086#M904881</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;This is the best duplicate record delete statement I have ever used.  I can't take credit for it, I found it on Metalink a long time ago:&lt;BR /&gt;&lt;BR /&gt;delete from contact&lt;BR /&gt;where rowid in&lt;BR /&gt;(select rowid from contact&lt;BR /&gt;minus&lt;BR /&gt;select max(rowid) from contact&lt;BR /&gt;group by email)&lt;BR /&gt;&lt;BR /&gt;You have to change the "group by" statement and the tables used, but this is clean, simple, and works really well.  &lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Fri, 12 Sep 2003 20:00:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066086#M904881</guid>
      <dc:creator>Brian Crabtree</dc:creator>
      <dc:date>2003-09-12T20:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Records</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066087#M904882</link>
      <description>looks like you want to keep the first row for each customer. so why not using the 'min' function? &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;delete from bts_caf_file where &lt;BR /&gt;cus_num||Loan_Lease||Prod_short||act_num not in &lt;BR /&gt;(Select min(cus_num||Loan_Lease||Prod_short||act_num) from bts_caf_file group by cus_num||Loan_Lease||Prod_short||act_num)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I guess this should work.</description>
      <pubDate>Mon, 15 Sep 2003 09:32:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-records/m-p/3066087#M904882</guid>
      <dc:creator>Sandro Schaer_1</dc:creator>
      <dc:date>2003-09-15T09:32:38Z</dc:date>
    </item>
  </channel>
</rss>

