Implement the Logic in Mapping to select, compare and update on one table

Hi All,
We have a Sales Order history table *(HISTORY_TABLE)* and we want implement the below logic in warehouse builder where we are using only one table for checking the condition and selecting the records to update in the HISTORY_TABLE.
Like
SELECT ORDERNO, LINENO, ORDERTYPE FROM HISTORY_TABLE A
WHERE EXISTS IN (SELECT ‘X’
FROM HISTORY_TABLE B
WHERE A. ORDERNO = B. ORDERNO
AND   A. LINENO = B. LINENO
AND   A.ORDERTYPE = B. ORDERTYPE
HAVING MAX (B.PDDJ) = 0)
Thanks in advance.

Hi,
you can implement this as
SELECT A.ORDERNO, A.LINENO, A.ORDERTYPE FROM HISTORY_TABLE A,
(SELECT ORDERNO,LINENO,ORDERTYPE FROM HISTORY_TABLE GROUP BY ORDERNO,LINENO,ORDERTYPE HAVING MAX(PDDJ) = 0) B
WHERE A.ORDERNO = B.ORDERNO
AND A.LINENO = B.LINENO
AND A.ORDERTYPE = B.ORDERTYPE Use Aggregator (group by with having) and then Joiner
Regards,
Oleg

Similar Messages

  • I'm getting a very low signal from my Blackbird interface. The fire wire connection is selected properly and track recording sliders set. However the recording level slider in the lower right corner is grayed out. How can I get better signal?

    I'm getting a very low signal from my Blackbird interface. The fire wire connection is selected properly and track recording sliders set. However the recording level slider in the lower right corner is grayed out. How can I get better signal?

    If it's slow on startup it would be extensions loading or LaunchDaemons starting up. 
    You should have a look in:
    /Library/LaunchDaemons
    /Library/Extensions
    You can count out anything in your home folder and it shouldn't put anything in /System as that's reserved for Apple. 

  • Mapping a CMP bean to more than one table

    Hello,
    I like to map a CMP bean to more than one table. I am using wlserver7.0 SP2. I
    have a VendorBean with a CMP field "comments" mapped to VENDOR_COMMENTS table.
    All other CMP fields in VendorBean are mapped to VENDOR table. Below is the snippet
    of weblogic-cmp-rdbms-jar.xml:
    <weblogic-rdbms-bean>
    <ejb-name>VendorBean</ejb-name>
    <data-source-name>sweepDataSource</data-source-name>
    <table-map>
    <table-name>VENDOR</table-name>
    <field-map>
    <cmp-field>expIndicator</cmp-field>
    <dbms-column>VENDOR_EXP_IND</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>vendorId</cmp-field>
    <dbms-column>VENDOR_SEQ_KEY</dbms-column>
    </field-map>
    </table-map>
    <table-map>
         <table-name>VENDOR_COMMENTS</table-name>
         <field-map>
    <cmp-field>vendorId</cmp-field>
    <dbms-column>VENDOR_SEQ_KEY</dbms-column>
    </field-map>
         <field-map>
    <cmp-field>comments</cmp-field>
    <dbms-column>VENDOR_COMMENT</dbms-column>
    </field-map>
    </table-map>
    As you can see, "vendorId" is the primary key cmp field mapped to VENDOR_SEQ_KEY
    column in both tables. The relationship between the table rows are 1 to 1. When
    I run ejbc, I get the exception below:
    [ejbc] weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Asserti
    on violated ]
    [ejbc] at weblogic.utils.Debug.assertion(Debug.java:74)
    [ejbc] at weblogic.ejb20.cmp.rdbms.RDBMSBean.processRole(RDBMSBean.java
    :1389)
    [ejbc] at weblogic.ejb20.cmp.rdbms.RDBMSBean.processDescriptors(RDBMSBe
    an.java:1105)
    [ejbc] at weblogic.ejb20.cmp.rdbms.Deployer.readTypeSpecificData(Deploy
    er.java:299)
    [ejbc] at weblogic.ejb20.persistence.PersistenceType.setTypeSpecificFil
    e(PersistenceType.java:490)
    [ejbc] at weblogic.ejb20.persistence.PersistenceType.setupDeployer(Pers
    istenceType.java:407)
    [ejbc] at weblogic.ejb20.deployer.CMPInfoImpl.setup(CMPInfoImpl.java:11
    4)
    [ejbc] at weblogic.ejb20.ejbc.EJB20CMPCompiler.generatePersistenceSourc
    es(EJB20CMPCompiler.java:64)
    [ejbc] at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:22
    3)
    [ejbc] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:3
    44)
    [ejbc] at weblogic.ejbc20.runBody(ejbc20.java:470)
    [ejbc] at weblogic.utils.compiler.Tool.run(Tool.java:126)
    [ejbc] at weblogic.ejbc20.main(ejbc20.java:711)
    But if I put the "comments" <field-map> inside the VENDOR <table-map> and get
    rid off the <table-map> for VENDOR_COMMENTS, I was able to run ejbc. Of course,
    I get the run time exception during deployment because, there is no column called
    "VENDOR_COMMENT" in VENDOR table. Please help me. Thanks a million.

    Wrong newsgroup, needs to go to one of the ejb newsgroups.
    mbg
    "Sai S Prasad" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hello,
    I like to map a CMP bean to more than one table. I am using wlserver7.0SP2. I
    have a VendorBean with a CMP field "comments" mapped to VENDOR_COMMENTStable.
    All other CMP fields in VendorBean are mapped to VENDOR table. Below isthe snippet
    of weblogic-cmp-rdbms-jar.xml:
    <weblogic-rdbms-bean>
    <ejb-name>VendorBean</ejb-name>
    <data-source-name>sweepDataSource</data-source-name>
    <table-map>
    <table-name>VENDOR</table-name>
    <field-map>
    <cmp-field>expIndicator</cmp-field>
    <dbms-column>VENDOR_EXP_IND</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>vendorId</cmp-field>
    <dbms-column>VENDOR_SEQ_KEY</dbms-column>
    </field-map>
    </table-map>
    <table-map>
    <table-name>VENDOR_COMMENTS</table-name>
    <field-map>
    <cmp-field>vendorId</cmp-field>
    <dbms-column>VENDOR_SEQ_KEY</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>comments</cmp-field>
    <dbms-column>VENDOR_COMMENT</dbms-column>
    </field-map>
    </table-map>
    As you can see, "vendorId" is the primary key cmp field mapped toVENDOR_SEQ_KEY
    column in both tables. The relationship between the table rows are 1 to 1.When
    I run ejbc, I get the exception below:
    [ejbc] weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[Asserti
    on violated ]
    [ejbc] at weblogic.utils.Debug.assertion(Debug.java:74)
    [ejbc] atweblogic.ejb20.cmp.rdbms.RDBMSBean.processRole(RDBMSBean.java
    :1389)
    [ejbc] atweblogic.ejb20.cmp.rdbms.RDBMSBean.processDescriptors(RDBMSBe
    an.java:1105)
    [ejbc] atweblogic.ejb20.cmp.rdbms.Deployer.readTypeSpecificData(Deploy
    er.java:299)
    [ejbc] atweblogic.ejb20.persistence.PersistenceType.setTypeSpecificFil
    e(PersistenceType.java:490)
    [ejbc] atweblogic.ejb20.persistence.PersistenceType.setupDeployer(Pers
    istenceType.java:407)
    [ejbc] atweblogic.ejb20.deployer.CMPInfoImpl.setup(CMPInfoImpl.java:11
    4)
    [ejbc] atweblogic.ejb20.ejbc.EJB20CMPCompiler.generatePersistenceSourc
    es(EJB20CMPCompiler.java:64)
    [ejbc] atweblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:22
    3)
    [ejbc] atweblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:3
    44)
    [ejbc] at weblogic.ejbc20.runBody(ejbc20.java:470)
    [ejbc] at weblogic.utils.compiler.Tool.run(Tool.java:126)
    [ejbc] at weblogic.ejbc20.main(ejbc20.java:711)
    But if I put the "comments" <field-map> inside the VENDOR <table-map> andget
    rid off the <table-map> for VENDOR_COMMENTS, I was able to run ejbc. Ofcourse,
    I get the run time exception during deployment because, there is no columncalled
    "VENDOR_COMMENT" in VENDOR table. Please help me. Thanks a million.

  • Why does mountain lion "bunch up" all my microsoft office documents that I have open when I hit f3? When I had snow leopard for example, if i had 4 or 5 different microsoft office documents open at the same time I could hit f3 and easily pick one of them

    Why does mountain lion "bunch up" all my microsoft office documents that I have open when I hit f3? When I had snow leopard for example, if i had 4 or 5 different microsoft office documents open at the same time I could hit f3 and easily pick one of them.
    Notice how in the photo, I can't identify which MS office document I would like to switch too. Perhaps since the Dashboard and Desktop windows are at the top of my screen now Apple doesn't let you have all the applications take up the full screen and be sized individually so that you can have a better idea on what to pick.
    I like the idea of grouping to an extent... If you have a bunch of random things it was hard for me to decifer between what was safari, chrome, or word. But now that they grouped them like this, if you have multiple pages of one program running, you can't switch between those pages easily like before.

    If I wanted to open any of my Applework documents I had to open them one at a time and resave them with pages. This could take weeks.I have 1000s of apple work documents.
    You don't have to open and re-save every AppleWorks document you have right now. Just wait till you need one, then do it. The documents aren't going anywhere.
    Am I dealing with Microsoft? This was a BIG surprise to me that Apple would release an OS without testing all programs.
    Frankly, it is not Apple's responsibility to ensure compatibiltiy with every piece of software available for OS X. That is the responsibility of the software vendor. Lion has been available to developers for several months before it's release, so Microtek had plenty of time to update their software. Yet they did not. How is that Apple's fault? I think Apple was very generous to give you a refund for Lion.
    I'm not trying to belittle your frustration but I do think your ire is misplaced.

  • Been using an ipad 2 without passcode for quite some time. While upgrading to ios 7, I enabled Find Iphone on the Ipad. It asked for passcode and I gave one. Now I forgot it.

    Been using an ipad 2 without passcode for quite some time. While upgrading to ios 7, I enabled Find Iphone on the Ipad. It asked for passcode and I gave one. Now I forgot it. Connected it iTunes (on my windows 8 system) with which I sync and that too required an update as old version of itunes cannot read ios7. Problem is itunes does not want to get updated. Some vague error on not having right to write a file in ProgramData folder wheras as an admin i have full rights. Next I downloaded the install file from itunes site - no luck it would not install. Then I tried to remove itunes - it does not want to go. Am at wits end... Is the option only to restore it as a new Ipad?

    Place the iPhone into recovery mode and restore the iPhone with iTunes on your computer.
    http://support.apple.com/kb/HT1808

  • HT201359 The new (09/19/13) Apple terms and conditions require one to click the AGREE button in order to update the apps;  however, there is no such button to click on.  Therefore I cannot update the apps on my iPhone.  Any ideas?

    The new (09/19/13) Apple terms and conditions require one to click the AGREE button in order to update the apps;  however, there is no such button to click on.  Therefore I cannot update the apps on my iPhone.  Any ideas?

    I was having the same problem, I had to go into iTunes on my laptop and agree to the terms there, and now i can download apps on my iPhone.

  • I tried to update my nephew iphone 4 version 4.3.4 (8k2), I did back-up everything before attempting to update and the result when I click down-load and update, it does not update instead it says,  itunes could not contact the iphone software update etc.

    Hi to all,
    I tried to update my nephew iphone 4 version 4.3.4 (8k2), I did back-up everything before attempting to update and the result when I click down-load and update, it does not update instead it says,  itunes could not contact the iphone software update server because you are not connected to the internet. I did check my wire-less connections and the connection from my PC to wire-less is hundred percent okay. I did search using google.com to confirm and my connections is good. Is there any problem regardings my firewalls or any help will be appreciated. Thanks

    Hi bosefire,
    Thanks for visiting Apple Support Communities.
    You can use the steps in this article to troubleshoot your iTunes connection:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    Regards,
    Jeremy

  • Hi ... I would like to ask you about the difference between Iphone 5 model A1428 and A1429, as one of my friend told me some of resellers they have A1428 and others have A1429. Now is that true or not, if your answer Yes what it is the difference?

    Hi ... Please I would like to ask you about the difference between Iphone 5 model A1428 and A1429, as one of my friend told me some of resellers they have A1428 and others have A1429. Now is that true or not, if your answer Yes what it is the difference?

    The difference is clearly stated on the technical specifications page for the iPhone, something you are just as capable of looking at as anyone else here.

  • HT201210 Error 37 after selecting 'Restore and Update' from iTunes

    Error 37 after selecting 'Restore and Update' from iTunes. 
    3GS had been working perfectly fine. 
    Now it's a Brick. 
    <Edited by host>

    Update and restore error messages on iPhone and iPod touch

  • My iPhone 5 speaker suddenly doesn't work properly!  The volume is so low I can't hear the phone ring.  I've restored and updated and done everything I can think of.  Please help!

    My iPhone 5 speaker suddenly doesn't work properly!  The volume is so low I can't hear the phone ring.  I've restored and updated and done everything I can think of.  Please help!

    Sorry, I think you got scam.
    Last thing you can try is restore as new:
    http://support.apple.com/kb/HT1414

  • Hi there - I can't open the YouTube website or any videos following and update to iOS 8.3 on my iPad 2. Can't anyone offer any advice? thanks.

    Hi there - I can't open the YouTube website or any videos following and update to iOS 8.3 on my iPad 2. Can't anyone offer any advice? thanks.

    If you're on the YouTube website on safari, then you should use the YouTube app, it works much better

  • Compare two fields of one table in selection.

    Dear Experts,
    I want to compare two fields of a table and make selection according to this.
    Ex: simply i want to select the rows from table mard where mard-labst>mard-insme. Could you write me the code to make this selection.

    Yes, Thomas,
    Its working:
    Sample code:
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select matnr ernam
           into table itab
           from mara where brgew > mara~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Or,
    Try with inner join once.
    Its working: Sample code.
    data: begin of itab occurs 0,
          matnr type matnr,
          ernam type ernam,
          end of itab.
    select p~matnr q~ernam
           into table itab
           from mara as p
           inner join mara as q
           on p~brgew > q~ntgew.
    loop at itab.
      write: itab-matnr.
    endloop.
    Thanks,
    Naveen.I

  • HT4623 Hi I'm new to ipad. I know I have downloaded from the App Store sky go, iplayer, itv player, 4OD etc but when I want to watch them I cannot watch. In the App Store I cannot select 'free' and the app icons are not on my screens. Please help

    Hi
    I'll write here too as this is the first time I've done this too. I'm new to ipad and I'm having trouble with icons appearing on my ipad after I have downloaded them. These are all tv based -sky go app, iplayers and on demand. I have installed them previously but since then there are no icons on my ipad to select. When I follow the link to the App Store to download, the 'free' tab or the price tab cannot be selected. Please help

    Hi there,
    Thank you so much. I said I was new to ipad lol. I put restrictions on about a month ago and have been ripping my hair out since. Wish I asked on here first lol. Are there any simple steps of advice you could offer or maybe an idiots guide lol
    Thanks again and best wishes..
    Kesfensome

  • Select all and deselect all in table control

    Hi experts,
        I want to make the select all and deselect all options in my table control.
    But i can't able to do that one. Kindly suggest me how to do that one.
    one more thing, if i select some rows in the table control, and press save it should be saved in some other table. how can i implement that one.
    Waiting for ur reply.
    Regards...
    Arun.

    Hi Arun,
    In the context node that you bind to the table, set the cardinality as 0..n and selection as 0..n. In the UI element Table, set the property selectionMode as 'multi'. Then a toggle button for select/deselect all will appear automatically in your table. You can see it in the top left corner.
    For your second question, after selecting the elemets and pressing 'save', in your event handler, do a get_selected_elements( ) on your node. This will return you a set of context elements. Loop through each element and do a get_static_attributes to get the rows. Then you can append these rows to another internal table and bind it to the context. Bind your second table to this node. If the two tables are in different views, the context nodes need to be present in the component controller and mapped to the views.
    Hope this helps.
    Regards
    Nithya

  • Compare three columns within one table. Help!

    Hi All
    I had a post up about this yesterday but I didnt have much luck and im still really stuck on this so if there is anyone who has any idea please help me.
    I have three columns A,B,C within the one table. Column A may contain a value that is in Column B so if this is the case I need to enusre that it is not brought back in the query. I have tried using a minus function but it is not working very well. Probably because i am doing it wrong.
    So basically I need the query to
    Compare
    (A) Column A with Column B - If a value is present in column B I want to minus it/remove it from Column B
    (B) Column A with Column C - If a value is present in column C I want to minus it/remove it from Column B
    (C) Column B with Column C - If a value is present in column C I want to minus it/remove it from Column B
    OUTPUT AT PRESENT
    COL A COLB COLC
    12345 45666 78888
    45666 78888 66666
    66662 12345 37891
    Desired Output
    COL A COLB COLC
    -------- 45666 78888
    -------- -------- 66666
    66662 12345 37891
    Any help with this would be really appreciated
    Thanks

    SQL> select * from poles;
            P1         P2         P3
           123        101        123
           456        123        456
           789        456        999
    SQL> select decode((select count(*)
      2                from poles
      3                where p2 = p.p1
      4                or p3 = p.p1),0,p1) p1,
      5          decode((select count(*)
      6                from poles
      7                where p3 = p.p2),0,p2) p2,p3
      8  from poles p;
            P1         P2         P3
                      101        123
                                 456
           789                   999                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • In material master MRP3 screen "checking group" field is missing,

    Dear All,    I am facing above problem.    can anybody help me to recall this field. Kishor

  • Changing Background issue with iPhoto

    So I'm trying to change my background but I'm running into problems with choosing from iPhoto Albums. The problem is not in my picture files because I am able to copy pictures into my Pictures Folder and apply them as my background as normal through

  • "Your system display driver has caused Photoshop to Crash" MacBookPro June 2012 MacOS 10.7.4 Photosh

    I am getting this error message when I launch Photoshop -- I just started getting it yesterday, August 28, 2012, when I tried to open a .tif image. Photoshop crashed.  What has changed?  I don't remember doing any updates to OS or to Photoshop.  I am

  • Application Availability

    Hi All, I want to use the status: Unavailable (Redirect to URL) in order to redirect the users to a public downtime page in the application. Is that possible? Also, Is not clear where I have to enter the URL where the users will be redirected. Regard

  • Airport express - netopia question

    hi i recently bought an airport express unit for the purposes of extending the range of my existing broadband signal in my house. There is poor reception in the downstairs area. The broadband connection is located upstairs and is a Netopia 3347WG box