How to delete data

I have a transaction table consists of duplicate records I success to write a sql
which get the duplicate records but unable to write the delete statement to delete
this record.
THe sql query is as follows:
Select invoice_no, slip_no, drug_code
from transaction_detail
having count(*)>1
group by invoice_no, slip_no, drug_code
If anyone knows please let me know the delete statement. Thanks in advance.
Regards
Muhammad Ali

Hi,
Check out following SQL:
DELETE transaction_detail td1
WHERE EXISTS ( select 'x' FROM
(Select MIN(invoice_no) invoice_no, MIN(slip_no) slip_no, MIN(drug_code) drug_code, MIN(rowid) t_rowid
from transaction_detail
having count(*)>1
group by invoice_no, slip_no, drug_code) td2
WHERE td1.invoice_no = td2.invoice_no
AND td1.slip_no = td2.slip_no
AND td1.drug_code = td2.drug_code
AND td1.rowid <> td2.t_rowid);
Check out following url for more interesting sql regarding deleting of duplicates:
http://www.oraclebrains.com/?p=115
Regards,
Raj

Similar Messages

  • How to delete data from single field in a database table?

    Hi guys,
         Plz suggest me How to delete data from single field in a database table?
    thnks,
    pavan

    hi
    in addition to abv details..chk this:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    http://dev.mysql.com/doc/maxdb/en/34/ee7fbd293911d3a97d00a0c9449261/content.htm
    regards,
    madhu

  • How to delete data in iCloud?

    How to delete data in iCloud? My iCloud data are just a mangled mess and I would like to delete them all and restart wiht data on my devices. How to do?

    Using your computer's browser, log into icloud.com and look at each of the pages to delete data.

  • How to delete data in LIS Structure S855

    HI All :
    I am new to this portal. I would like to know how
    to delete data in LIS Structure S855. Actually, this table contains errorneous data and like to clear it up and run stats setup to refill it up.
    Though we have T-Code:lbwg to delete setup tables for LO.
    Likewise do we have any transaction to delete LIS table.
    If not, how to delete the same.
    Thanx & Regards:
    Rafi

    hi roberto,
                 this is nataraj.i am really a novice.i have gone through this discussion.since lis s855.its kind of table.can we delete like a table using debugging?hope u have got me.correct me if am wrong.
    i will be waiting for your feedback.
    regards,
    nataraj.

  • How to delete data off time capsule and restart

    how to delete data off time capsule and restart

    Open Finder > Applications > Utilities > AirPort Utility
    Click on the Time Capsule, then click Edit in the smaller window that appears
    Click the Disks tab at the top of the screen
    Click Erase Disk
    Choose the Quick Erase option
    Click Erase
    The procedure will take a minute or two.  The Time Capsule is now ready for a new backup

  • How to  delete data completely

    Hi
         please tell how to delete data completely in my sap ides that is removing permanently the master data, sales documents and i want configured every setting back from start. i want to make it as completely newly created sap ides.

    Dear Teja,
    Just get it installed Again
    Regards
    Suchait

  • How to delete data-records with BI-planning in BEx?

    Hi folks, masters and gurus,
    we just upgraded some of our functions from BPS to BI-Planning.
    Only one thing I could not resolve up to now:
    In BPS (web based) it was easily possible to delete data-records by choosing a radio-button beside the data-entry-field and click the "delete"-button (a red "-") on the top.
    When I tried to find a delete-function in RSPLAN now I only found one that deletes the data, but not the record itself.
    Does anyone know how to build a function that I can use to delete data-records?
    Thx in advance for your help,
    Thomas

    Oh yes ... it´s not necessary as it is easily possible to supress lines with only 0 in it with
    query-properties / rows/coloumns / supressing Zero / activ ...
    Edited by: Thomas Kejik on Jan 19, 2009 9:46 AM

  • In a PrC, how to delete data from the PSA that have been loaded in Prcs Chn

    Hello,
    In a process chain, how can I delete the data from the PSA that have been loaded within that process chain. I don't want to delete data that belongs to other business units that use the same datasource.
    Thanks,
    Andre

    I dont think so you can achieve that, PSA is actually datasource dependent.
    One you load from a datasource to PSA.That is accesible by multiple DTPs if you have created so.
    As you said "I don't want to delete data that belongs to other business units that use the same datasource."
    If you delete the PSA, you may have to repull the data from source system again and if thats delta it wont work out.
    As said by above ppl you can include the "Delete PSA" in process chain but choose some 15 days buffer.
    Hope this helps.

  • How to delete data from Open Hub DB table when the DTP is inactive..

    Hi Gurus,
    I am transporting some 2LIS extractors to QA with some enhancements.
    The data goes to an OHD ( third party ) pulled by a process outside SAP enabled by a BAPI.
    Now , By mistake , I imported the OHDs with still some old left in the DB table of OHD ( /bic/oh<>)
    It's not allowing to me do manual activation and also DTP is inactive ( cannot do a delta DTP and make no of records zero )
    I want to delete the data in the OHD DB tables ..any clues....
    Thanks,
    Chetan

    Hi Chetan,
    The OHD table name is usually /BIC/OH<OHD-name> .  You can find it in the OHD definition.
    Go to transaction se14, give the table name and say edit.
    Select Delete Data and say Activate and adjust database.
    This will delete the entire contents of the OHD DB table.
    Regards,
    Uma Maheswari

  • How to delete data in SAP Tables

    Can i delete data in SAP tables in IDES version? I need step wise answer.
    Best answer get good points.
    Regards
    Kalyan Pothini

    Hope this helps:
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci1159707,00.html
    Fast deletion of SAP table content
    Stan Shuralyov
    01.17.2006
    Rating: -3.86- (out of 5)
    If a table has millions of records, full deletion becomes time consuming. Try this tip when you need to delete data quickly -- it works in seconds.
    Editor's note: This tip works on an SAP 4.6C, WAS620 and WAS640 system (i.e., all currently suppported SAP platforms). Note that it is a tricky function that should only be used by programmers who know what they are doing.
    Code
    Use function from SE14
            call function 'DD_DATABASE_UTILITY'
                 exporting
                      fct                     = 'MDF'
                      obj_name                = 'TABLE_NAME'
                      obj_type                = 'TABL'
                      exec_modus              = 'S'
                 importing
                      subrc                   = sl_subrc
                 exceptions
                      unexpected_error        = 1
                      unsupported_function    = 2
                      unsupported_obj_type    = 3
                      table_is_locked_by_tcnv = 4
                      authority_check_failed  = 5
                      abort_function          = 6
                      conversion_error        = 7
                      others                  = 8.
            if sl_subrc = 0 and sy-subrc = 0.
              write:/ '&1', '- Table Deleted OK'.
              commit work and wait.
            else.
              sl_status = 1.                          "Deletion Failed
              write:/ '&1', '- Table Deletion FAILED'.
            endif.

  • How to delete data older than three years from DSO

    Hi  all,
    We needs to keep historical data in the DSO only for three years. One way of doing this is by selective deletion we can delete data older than three years but we want to make it authomated. Is it possible to add a process or ABAP program to delete data older than three years.
    If it is p[ossible by ABAP code then can you please give me sample code.
    Many Thanks in advance.
    Harman

    Some time for in case of huge volume of data selective deletion is not works, Try for "prunning" option.
    It's work as follows
    1)     Create DSO which is same replica of your Source DSO.
    2)     Create two transformation
         a) from Source DSO to Copy DSO
         b) Another is from Copy DSO to Source DSO
    3)     Transprort Last 3 years records to Copy of Source DSO using DTP Filter range for time.
    4)     Once data loading from Source DSO to Copy DSO get completed delete all data from Source DSO.
    5)     Now load data from Copy DSO to Source DSO.
    6)     After complete loading delete entire data from Source DSO.
    I use prunning process to one of my client and it's work perfectly.
    Regards,
    Sushant
    +919820849482

  • How to delete data from hard disk before returning Macbook Air to the store

    I need to return a recently purchased Macbook Air to the store. How do I delete all data from the hard drive before I return the notebook?

    Ahh, you want to WIPE the entire drive,.....command R on startup, disk utilities....select MacIntosh HD,......ERASE it format it in MAC OSX extended journaled.
    after than, you can do a wifi or ethernet reinstall to factory OUT OF BOX new condition.    Usually takes 1.5 to 2 hours if you have a descent fast www connection.

  • How to delete data from the table PA0007

    Hi Friends,
    Thank you for your kindly help.
    When I upload data to infotype 0007(planed working time),
    there is something wrong with the infotype 2011. So I want
    to delete the data of  infotype 0007. While using the program RPUREOPN to delete the data, the system will say:0007 cannot be deleted because of time constraint 1/A.
    Now how can I delete the data from table PA0007?
    Pls help me urgently.
    Best wishes
    Anne

    Hi Sikindar,
       Thank you for your help.
      There is another question. There are five clients (Client 300,310,320,330,350) in my HR DEV system. I just want to delete the data of infotype 0007 in client 350. When I change the the time constraint and delete the data in client 350, the data of infotype 0007 in other clients will be safe or not?
    Thank you again for your help!
    Best wishes
    Anne

  • How to delete data from dynamic internal table

    Hi,
    I have dynamic internal table and I have some slection screen fields , using these selection screen fields
    (select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
    and also delete will not work for dynamic table..
    as we cannot use assigning with delete..
    So how to do this?
    and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
    so now after selection of data, I need to filter the data from dynamic table.
    Is there any way to do this?
    Regards,
    Mrunal

    Hi matt,
    I tried with below code as  you said. But I am getting dump. can you help?
    here is my piece of code.
    FIELD-SYMBOLS: <LS_DATA> type any,
                               <LT_DATA> TYPE table,
                                <L_FIELD> type any.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
    LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
    ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BUKRS.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BELNR.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ENDLOOP.
    and here is the description of my dump:->>>
    You attempted to access an unassigned field symbol
    (data segment 32772).
    This error may occur for any of the following reasons:
    - You address a typed field symbol before it is set using ASSIGN
    - You address a field symbol that points to a line in an internal table
      that has been deleted
    - You address a field symbol that had previously been reset using
      UNASSIGN, or that pointed to a local field that no longer exists
    - You address a global function interface parameter, even
      though the relevant function module is not active,
      that is it is not in the list of active calls. You can get the list
      of active calls from the this short dump.

  • How to delete data from a file using IO package

    Hi All,
    i am trying to remove some content of the file.
    this content is not at starting of file not even at end of file.
    can anybody tell me how can i delete number of lines from file using IO package.

    iam having some data in text file .ex:in flowrist.txt
    12/5/07,500,300,6000 like many set of datas are
    there.In these if i want to delete the data based on
    the date which i specified.How to do this specific
    deletion?You need to open a stream to read in the file and then use the indexOf method provided in the Sting class to check if the line contains the date or whatever String you are looking for, if so then skip that line and store or re-write the lines you wish to keep, as well as some extra lines you may wish to add.
    Take a look below at this example found on Google.
    http://www.java-tips.org/java-se-tips/java.io/how-to-read-file-in-java.html
    The above read a file line by line and prints it to console. You should be able to modify this, instead of using System.out to print the line you should use index of to check the lines for a date/String. Index of return -1 if the String you specify is not in the line you parse.

  • How to delete data from flat file ?

    Hi all,
    I deleted a record from a tables and I want to delete it from data file.
    Can I do it ?
    Pls help me !

    What do you mean by deleting it from datafile ?, Is it flat file or something else you want to ask? I believe you have records in flat files and you want to delete them as soon as you load them into oracle table.Oracle dosent offer such facility, however you can syncronise your tables and flat file contents by using merge statements and update it in a fashion, so that only records which reflects in flat files syncronises with table in oracle database .
    hare krishna
    Alok

Maybe you are looking for

  • Nano + Vista

    Does not Ipod Nano 4Gb and Itunes works yet width Windows Vista? Runs Vista Home prem and my computer dont finds any drivers for the ipod when i connect it, have the latest Itunes and firmware in the ipod. /p

  • Using a source file to test behaviors

    I am developing some special mail handling features, based on the message content and some library information that I have. I don't want to go to the trouble of setting up a POP3 server since I have the test data in flat files. Has anyone developed a

  • VNC to PC

    I have a new MacBook and am trying to control my Windows XP pc. The XP box has Tight VNC server running and I downloaded Chicken of the VNC for my MacBook. The connection works and I can see the XP desktop, but it is super super slow. The mouse is ab

  • TOC not updating when creating PDF from Robo9

    I have not really created PDFs from Robo before, so I might be missing something basic. I am trying to create Word and PDF documents from my Robo9 project. My problem is that some of my topics are not being generated, in either the Word output or the

  • Formated computer

    Hi! I'm new to the forum and I'm in a dilemma. I had to format my laptop and reload all my data. I can't sync my music to the new i-tunes that I downloaded from the Apple site. A message that the iPod can only sync with one i-tunes that already exist