How to delete one record out the two?

Hi all,
A have an Orders table:
ACCOUNT, ORDER_NO, ORDER_DATE
I have a few cases where there two accounts have the same ORDER_NO. I dont think this is right in a traditional Orders/ Orderline relationship!
For Example:
ACCOUNT     ORDER_NO     ORDER_DATE
WYM01     O15506     01/09/2004
DA4060     O15506     01/09/2004
What is the best way to delete one of these? There are quiet a few so I was looking into cursors.
Thanks

You can do it like this
DELETE
  FROM orders
WHERE ROWID IN ( SELECT row_id
                    FROM (SELECT ROWID       row_id
                                ,ROW_NUMBER () OVER ( PARTITION BY order_no
                                                          ORDER BY ROWID
                                                    ) row_num
                            FROM orders
                   WHERE row_num <> 1
                );Regards
Arun

Similar Messages

  • How to delete a record in the target?

    Hi all,
    In my source i'm having three tables which are joined.My source and target is oracle.
    I'm using IKM incremental update oracle.For SCD-1.If i delete a record in any of my source tables i cannot able to delete that particular
    record in the target table.I tried by doing CDC(simple) to all my source tables.But still i cannot able to delete a record in the target table.
    How to resolve this issue? Please help me.
    Thanks in advance

    Open your interface, go to the "flow" tab and then, try to set the option "delete_all" to "Yes". Doing it, all records will be deleted in the target table and only the records that still exists at source will be loaded the next time you run the interface.
    I hope this will help with your issue.
    Regards,
    Daniel Hein

  • How find just one record on the table

    Hi,
    I've this table TAB_DV:
    COD_ID.........DV_ID
    001............A
    002............A
    002............B
    002............C
    002.............
    003............
    004............GG
    004............DD
    004............FF
    004............MM
    004............TT
    008.............BB
    0022..............
    0033..............
    0044............A
    0044............
    0055............FF
    0066............
    I'd like to find only the COD_ID that have one record (in the table TAB_DV) without dv_id:
    In my case:
    COD_ID.........DV_ID
    003............
    0022..............
    0033..............
    0066............
    If I run:
    SELECT COD_ID, DV_ID
    FROM TAB_DV
    WHERE DV_ID IS NULL
    GROUP BY COD_ID, DV_ID;
    I get also COD_ID with more records.
    How can I write this query?
    Thanks in advance.

    try this
    select cod_id
      from tab_dv
    where dv_id is null
    having count(cod_id) = 1
    group by cod_id
    or
    select t1.cod_id, t1.dv_id
      from tab_dv t1
    where t1.cod1 in (select cod_id
                         from tab_dv t2
                       having count(t2.cod_id) = 1
                       group by t2.cod_id)
       and t1.dv_id is null

  • How to delete Duplicate records from the informatica target using mapping?

    Hi, I have a scenario like below: In my mapping I have a source, which may containg unique records or duplicate records. Source and target are different tables. I have a target in my mapping which contains duplicate records. Using Mapping I have to delete the duplicate records in the target table. Target table does not contain any surrogate key. We can use target table as a look up table, but target table cannot be used as source in the mapping. We cannot use post SQL.

    Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1                                    File2     H|ABCD|Date.                      H|EFGH|Date.1                                            42                                            5  3                                            6 Target tale: Id    Name1     ABCD2     ABCD3     ABCD4     EFGH5     EFGH6     EFGH can anyone help on what should be the logic to get this data in a table in informatica.

  • How can I reference records outside the two date parameters?

    Hi all,
    I have a query that fetches records based on the two date parameters defined (Startdate and Enddate).
    If the Startdate is 2014-12-01 and the Enddate is 2014-12-12, I want to pull records outside these two date parameters, that is      2014-09-01 and 2014-11-30.
    I want to add up the records from  2014-09-01 and 2014-11-30 and include them in one of the columns in my report.
    I tried using this query:
     SUM(CASE WHEN FilteredIncident.Statuscodename IN ('QUEUED', 'ASSIGNED') AND (EnteredOn >= '2014-09-01' AND EnteredOn<= @StartDate) THEN 1 ELSE 0 END) AS OpenRecords
    Please help with any ideas..thanks

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you probably need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    There is no such crap as a “status_code_name” in RDBMS. It has to be a “<something in particular>_status”; think about how silly that data element name is! Want to keep going and have a “status_code_name_value_id”? LOL! 
    The name “Filtered_Incident” is also wrong. Tables are sets, so unless you have only one element in this set, the table name should be a plural or (better) collective name. But a better question is why  did you split out “Filtered_Incidents” from “Incidents”?
    Would you also split “Male_Personnel” and “Male_Personnel” from “Personnel”? 
    Get a book on data modeling and learn some basics. 
    >> I have a query that fetches records [sic: rows are nor records] based on the two date parameters defined (report_start_date and report_end_date). If the report_start_date is 2014-12-01 and the report_end_date is 2014-12-12, I want to pull records [sic]
    outside these two date parameters, that is 2014-09-01 and 2014-11-30. I want to add up the records [sic] from 2014-09-01 and 2014-11-30 and include them in one of the columns in my report. <<
    Having no DDL and no sample data makes this hard. Does your boss make you program without any documentation, DDL, etc? This spec is vague; you say to do a total, but show a count, etc. 
    One of the many nice things about DATE data types is that the BETWEEN predicate works with them, so you can quite writing 1960's BASIC predicates with primitive logic operators. 
    Here is a guess: 
    SELECT SUM(CASE WHEN incident_date BETWEEN '2014-09-01' 
               AND @report_start_date THEN 1 ELSE 0 END)
           AS open_record_cnt 
      FROM Incidents
     WHERE incident_status IN ('QUEUED', 'ASSIGNED')
        AND incident_date <= @report_end_date; 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to delete one number in the dial pad dropdown ...

    When calling a phone number from Skype, I mistyped the phone number.  Now whenever I call a phone number, the dial pad's dropdown list includes the mistyped phone number.  I want to delete that single number from the dial pad's dropdown list.
    Unfortunately I obeyed some people's suggestions in other topics.  Now the contents of all chat histories with all ordinary Skype contacts are gone.  I used to save logs of those forever, but the attempt to delete one phone call history actually deleted all chat histories with everyone.  That was not what I wanted. ... And then, to add insult to injury, whenever I call a phone number, the dial pad's dropdown list still includes the mistyped phone number that I want to delete.
    Is there any way to do it?
    Even though I make more typos than everyone else, even though my keyboard's Backspace button gets a pounding, surely I'm not the only one?

    NOT My day - just typed out a message and clicked Preview. The message is gone. Short reply - this is suppose, at heart, to be a telephone system. BASICS like keyboard entry error correction should be available (in an intuitive way). Backspace doesn't erase last entry and you cannot even delete ALL the entry. Would you fix this or explain why it cannot be done - and then find out how it can.

  • How to delete one number in the dial pad dropdown list?

    When calling a phone number from Skype, I mistyped the phone number.  Now whenever I call a phone number, the dial pad's dropdown list includes the mistyped phone number.  I want to delete that single number from the dial pad's dropdown list. Unfortunately I obeyed some people's suggestions in other topics.  Now the contents of all chat histories with all ordinary Skype contacts are gone.  I used to save logs of those forever, but the attempt to delete one phone call history actually deleted all chat histories with everyone.  That was not what I wanted. ... And then, to add insult to injury, whenever I call a phone number, the dial pad's dropdown list still includes the mistyped phone number that I want to delete. Is there any way to do it? Even though I make more typos than everyone else, even though my keyboard's Backspace button gets a pounding, surely I'm not the only one?

    NOT My day - just typed out a message and clicked Preview. The message is gone. Short reply - this is suppose, at heart, to be a telephone system. BASICS like keyboard entry error correction should be available (in an intuitive way). Backspace doesn't erase last entry and you cannot even delete ALL the entry. Would you fix this or explain why it cannot be done - and then find out how it can.

  • How to delete one record at a time

    hi all,
    Please tell me how i do delete only one record at a time.After deleting the record the jsp page should show only the remining items to be deleted.

    Where do u want to delete the record - database?
    If so use the rpimary Screen identifying each record and use that to delet that record

  • How to block one invoice out of two in APP

    Gurus,
    For one vendor 2 invoices are due.  because of some reasons, I don't want to pay one invoice out of that.  so it should not pickup in APP. How to block a particular invoice.

    Hi
    In APP after you run the Payment Proposal , payment proposal will be created.
    select Edit proposal button , you will see the 2 invoices.
    double click on the amount and again double click on the document which you do not want to pay.
    give payment block : A and enter and save.
    now you select schedule payment run , payment for only 1 invoice will be paid.
    here you will see 1 posting order generated & completed.
    Regards
    Venkat

  • How to delete a company in the system?

    Hi all,
            i am create three companies in the same B1 system. Now i just want to know how to delete one company from the system?
    thanks,
    Suresh Yerra.

    Hi Rajesh,
                  It's very simple.
    1. login to SQL Server
    2. In the databases u can find the three companies
    3. delete the particular company database from the SQL databases.
    Let me know if u have any queries regarding this?
    Thanks,
    Suresh Yerra.

  • DOUBT IN PE51...MISTAKENLY ADDED SAME WAGETYPE 2 TIMES..HOW TO DELETE  ONE

    Hi Experts,
    I have mistakenly added 1 wagetype  for 2 times in the earnings side and saved in a request.How to delete one wagetype from the screen.If we put 2 wagetypes could it be a problem...
    Please advice me...
    Thanking u.
    sai.

    Hai..
    Remove the wage type and save in the same request.
    or...
    Go to SE09, Give ur user name and check for the request & the date that u raised. Simply delete that request and create a new one....
    Edited by: manu on Dec 20, 2007 2:36 PM

  • I have two Apple ID, how can I delete one and use the email address associates to the main one?

    I have two Apple ID, how can I delete one and use the email address associates to the main one?

    If you abandon one of the Apple IDs you will also basically be abandoning any content that you have acquired with that Apple ID. Content can only be updated and re-downloaded with the Apple ID that was used to buy it. Apple will not combine the content of Apple IDs and Apple will not transfer the content from one Apple ID to another Apple ID.

  • How to load  2 records out of 4records to the  datasource....

    how to load  2 records out of 4records to the  datasource....

    Hi
    when you execute the Infopackage of the datasource, restrict the selection screen to only those 2 records
    Regards

  • How to use one commandButton  to execute two task in JSF

    I have a form in JSF page which contains different faces components. These faces bind to ADF BC to insert one row in the database when the user press commandButton. Also I need to bind the value of one inputText in that form to managed bean to execute another task in the application when the user press the same commandButton.
    The code of the inputText:
    <h:inputText value="#{bindings.ProjectNumber.inputValue}"
    id="pn"
    size="10"
    required="#{bindings.ProjectNumber.mandatory}">
    The code of commandButton:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}"/>
    The managed bean is “findInspector”. I tried to insert inputHidden inside commandButton tag and assign the value of the inputText to the inputHidden as follows:
    <h:commandButton actionListener="#{bindings.Commit.execute}"
    value="Save"
    disabled="#{bindings.Commit.actionEnabled}">
    <h:inputHidden value="#{bindings.ProjectNumber.inputValue}" binding="#{findInspector.project}"/>
    </h:commandButton>
    But it was not work
    Please how can I write the code to use the value of the inputText more than one time in the JSF(one to insert one row by using ADF BC and another to use the same value to bind to a managed bean) and how to use one commandButton to execute two task in JSF.
    Thank you
    Waheed

    Yes I did
    <managed-bean>
    <description>The bean for get project No</description>
    <managed-bean-name>projectBean</managed-bean-name>
    <managed-bean-class>
    mcscm.model.ProjectBean
    </managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    </managed-bean>
    Also I changed the method in the managed bean as follows:
    public String commandButton_action() {
    FacesContext fctx = FacesContext.getCurrentInstance();
    ValueBinding vb = fctx.getApplication().createValueBinding("#{bindings}");
    DCBindingContainer dcb = (DCBindingContainer) vb.getValue(fctx);
    OperationBinding operation = (OperationBinding) dcb.get("projectNumber");
    operation.execute();
    return null;
    where projectNumber is my method in the java class of the application module "TaskInformationImpl". I made this method to be accessed from outside of ADF BC.
    I just create a sample code for projectNumber method for testing only as:
    public void projectNumber (String data){
    System.out.print(data);
    In the page Pagedef file I added this :
    <methodAction id="projectNumber"
    InstanceName="TaskInformationDataControl.dataProvider"
    DataControl="TaskInformationDataControl"
    MethodName="projectNumber" RequiresUpdateModel="true"
    Action="999" IsViewObjectMethod="false">
    <NamedData NDName="data" NDValue = "#{bindings.ProjectNumber.inputValue}" NDType="java.lang.String"/>
    After I did all of this I get a new error like:
    javax.faces.FacesException: #{projectBean.commandButton_action}: javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding cannot be cast to oracle.adf.model.OperationBinding
    Is it very difficult to do this in JDeveloper?. yes ADF BC provide me a lot of facilities, but when I want to do a specific task I face a lot of troubles

  • How to delete duplicate records in cube

    Hi,
    can u help me how to delete the duplicate records in my cube
    and tell me some predifined cubes and data sourcess for MM and SD modules

    Hi Anne,
    about "duplicate records" could you be more precise?.
    The must be at least one different Characteristic to distinguish one record from the other (at least Request ID). In order to delete Data from InfoCubes (selectively) use ABAP Report RSDRD_DELETE_FACTS (be carefull it does not request any confirmation as in RSA1 ...).
    About MM and SD Cubes see RSA1 -> Business Content -> InfoProvider by InfoAreas. See also for MetadataRepository about the same InfoProviders.
    About DataSources just execute TCode LBWE in you source sys: there you see all LO-Cockipt Extrators.
    Hope it helps (and if so remember reward points)
    GFV

Maybe you are looking for

  • How do I get the number of channels available in DIAdem using VBScript?

    I want to know the last number of the available channels in DIAdem-DATA using VBScript. If there are not enough channels, I'll allocate new ones using ChnAlloc. For the first run of the script, I do know there're 60 channels, but in a second run I mi

  • Problem with line items print in Script MAIN window.

    Dear Friends, I am facing a problem with display the line items in main window. Here i have created my form with 2 pages, in first page i have created header window(my header information is full length of page), in second page i have created 2 window

  • Infopath 2007 "Updating Site Content Failed"

    I get this error for just about everything I do with the forms we are publishing via Infopath 2007.  I believe it is because our forms have a fair amount of Promoted fields in them (more than 30 each). I've seen this article and think that maybe it w

  • Creditpositive parameter in Transformation Rules

    Dear all, Just need some clarity on this. My understanding is that if we set this parameter as 'NO' then it will reverse the signs of Accouts with Type LEQ and INC. Is that correct? Now, if I'm loading a flat file wherein I've stored all INC/ LEQ acc

  • Create Outlines not working

    I'm running ID CS6, v. 8.0.1 on Mac OSX 10.6.8. When I try to convert type to outlines, the Create Outlines option is grayed out. Also, it says 'Create Outlines menu' instead of just 'Create Outlines'. I tried selecting the text box as well as just h