Can I do this in merge?

This query
select
--count(CONRTRM_PIDM),
conrtrm_pidm,
conrtrm_aidy_code,
conrtrm_fund_code,
conrtrm_offer_amt,
conrtrm_offer_date ,
conrtrm_activity_date,
conrtrm_disb_final_ind,
conrtrm_memo_exp_date,
conrtrm_orig_offer_amt,
conrtrm_orig_offer_date,
conrtrm_accept_amt,
conrtrm_accept_date
from
conrtrm
where
conrtrm_pidm = 102366 produce the following results
CONRTRM_PIDM CONRTRM_AIDY_CODE   CONRTRM_FUND_CODE               CONRTRM_OFFER_AMT              CONRTRM_OFFER_DAT E                    CONRTRM_ACTIVITY_DATE         CONRTRM_DISB_FINAL_IND
102366                                   0708                          FSTAFS                                             1,000                                         20070207                                      20110413                                             Y
102366                                   0708                          FSTAFS                                             1,000                                         20070207                                      20110413                                             Y
102366                                   0708                          FWS                                                    950                                           20070207                                      20110413                                            Y
102366                                   0708                          FWS                                                    950                                           20070207                                      20110413                                            Y
102366                                   0708                          SKIDGR                                             8,425                                          20070207                                      20110413                                            Y
102366                                   0708                          SKIDGR                                            8,425                                           20070207                                      20110413                                            YI need the following results I need to merge the amounts?
IF
CONRTRM_PIDM CONRTRM and CONRTRM_AIDY_CODE and CONRTRM_FUND_CODE are the same I need to merge the amounts and choose the max(actiovity date) the activity date can be different
for example the code
FSTAFS
should be ended in the results
As a
102366 0708 FSTAFS AS 2000 (one row) merge the amounts and with the max activity date (CONRTRM_ACTIVITY_DATE )
FWS one row 1900
SKIDGR one row (16850)
How I can do this using merge (not too much experience with the merge queries)
Thank you

Hi,
MERGE is a DML statement that can do both INSERT (add new rows to a table) and UPDATE (change existing rows).
Do you want to change the table, or do you want to run a query (that is, a SELECT statement) that shows data already in the table, without changing what is stored?
If you just want a query, then you want GROUP BY, where each row of output may represent more than one row from the original table. (I think that is what you meant when you said "merge".)
I think you want something like this:
SELECT    conrtrm_pidm, conrtrm_aidy_code, conrtrm_fund_code
,       SUM (conrtrm_offer_amt)     AS total_amt
,       MAX (conrtrm_activity_date)     AS last_activity_date
FROM       conrtrm
WHERE       conrtrm_pidm     = 102366
GROUP BY  conrtrm_pidm, conrtrm_aidy_code, conrtrm_fund_code
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
If you really do want to change the table, then the INSERT statements you post should show how the tables are before the DML, and the results will be the contents of the changed table(s) after the DML.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on May 12, 2011 3:25 PM

Similar Messages

  • I have created 2 photo books and would like to merge them into one. How can I do this?

    I have created 2 photo books and would like to merge them together.  How can i do this?

    You can't just merge them. You will have to add the photos of Book B to Book A and add new pages to A to duplicate those in B.
    NOthing was said about copying and pasting - you add the photos from book B to book a, add pages to bbok a and recreate teh pages in book a
    Another way would be to print book B to PDF sending the PDF to iPhoto and then placing the pages as full page images in book A
    LN

  • HT204053 My wife and I both have music on each of our accounts but we would like to merge our libraries so we can both access our music together. How can we do this?

    I bought an ipod nano for my wife for Christmas and added music to it from my library. She now wants to add some of her music from her library on her mac. How can we do this??

    You will have to continue to share since you cannot merge Apple ID related accounts.  They are permanently separated.

  • My iPhone is merging different contacts with the same firstname into one contact. How can i resolve this.

    My Bosses iPhone is merging different contacts with the same firstname into one contact. How can i resolve this? He seems very disturbed and thinks i don't know what i'm doing. I've set up all his devices to sync across and now its messed up on his iPad, and two iPhones.
    E.G Contacts with firstname 'Adams' and different numbers are synced into one account.
    Now i have no clue how many contacts are this way cos he has a huge number of contacts (he's the ceo).
    Please i need a suggestion on how to fix this.
    Thanks for the help.

    Janie Mac wrote:
    Cannot find settings to then go to general then about.
    How do I edit the device in iTunes?
    Double-click on the name.
    My screen shot shows both devices because I sync wirelessly.  Right now I can change the iPod name but not the iPad name because the iPod is idle while the iPad is syncing.  In another minute or two, I'll be able to change the iPad name.

  • HELP PLEASE!  I logged in with my iCloud account and merged her contacts with mine how can I undo this If i log out her contacts erase and stay on my iPhone and visa versa

    HELP PLEASE!  I logged in with my iCloud account and merged her contacts with mine how can I undo this If i log out her contacts erase and stay on my iPhone and visa versa

    One of you will need to migrate to a separate iCloud account, then you can delete the other person's data from each account.
    To migrate to a new account, start by saving an photo stream photos that are not in your camera roll to your camera roll.  To do this, open your my photo stream album, tap Select, tap the photos, tap the share icon (box with upward pointing errow), then tap Save to Camera Roll.  Then go to Settings>iCloud, tap Delete Account, choose Keep on My iPhone when prompted, provide the account password to turn off Find My iPhone when prompted, then sign in with a different Apple ID to create the new account and choose Merge to upload your data.
    You can then each to to your iCloud accounts on icloud.com from your computer and delete the other person's data from your account.

  • I have to Apple ids in email format--how can I change this to just one and merge all of my existing purchases and apps under one ID?

    I have two apple id's in email format--how can i change this to just one and merge all of my apps and tunes under the one retained ID?

    Sorry Duane..
    Apple does not support the merging of accounts >   Frequently Asked Questions About Apple ID
    messaged edited by cs

  • Photomerge panorama produces an empty merge file from two images; how can I fix this? Thanks

    Photomerge panorama produces an empty merge file from two images; how can I fix this? Thanks

    If you did not create this swf yourself then you won't be able to do what I am suggesting.  If you did, then open the fla in Flash and go into the Publish Settings and select the option to publish an html file as an output.  That will create an html page that embeds the Flash file.  Test that file in your browser and see if it plays properly.  IF so, then copy that code in place of whatever Dreamweaver did to embed the Flash.
    Dreamweaver is not a reliable tool for embedding Flash content... why it does not do it the same way Flash does it is anyone's guess.

  • HT204053 I use my iMac to help a friend with an IPAD and a different Apple ID to transfer their existing cps to iTunes on their iPad.  How can I do this without the content being merged into my own Apple ID Account

    I have an IMac which is my main computer and two IPads and an Ipod Nano.
    Obviously we use these in sync as an when required via Itunes.
    I have recommended a friend to have an IPAD2 and she wishes to load some of her existing cds into her Itunes Account.
    If I wish to do this with my own, it is simple as we simply use the Imac which transfers content into Itunes.
    However, my friend does not have a separate computer so I wish to load her CD's into Itunes and then sync to her Ipad without interfering with my own library and using her Apple ID.
    How can I achieve this?

    " how can I sync my iphone to my mac book without losing all the music and pictures on it?"
    You cannot.  Copy everything you want form the old computer to the new one, then sync it.
    it basically says you have to erase your iphone to sync to a new itunes!
    Correct Iphone will sync, or manually manage, with one and only one computer/library at a time. Syncing, or manually managing, to another will indeed erase the current content.

  • My apple id is with gmail, I want to change it and create an @me email address. How can I do this?, My apple id is with gmail, I want to change it and create an @me email address. How can I do this?

    My apple id is with gmail, I want to change it and create an @me email address. How can I do this?, My apple id is with gmail, I want to change it and create an @me email address. How can I do this?

    You can't merge accounts, if you start using the gmail account for iCloud by logging out of the me ID in system preferences and back in using the gmail ID, you'll need to copy all your data in calendars etc to the gmail account. you also won't be able to use the me address for mail unless you add the me account as a secondary account at system preferences > mail, contacts and calendars.

  • I have an iPhone that was set up as a backup of another phone. I want to sync it with my current library; am afraid of losing synced contacts. Will I? Can I prevent this?

    The older phone in question was a work phone that was set up by the owner and then distributed to employees for use. I have a new phone that will be for personal use that I have backed up from the work phone;mainly for the contacts. I want to sync the new phone with my personal library, and I go to do so and get the infamous "erase and sync" message. Will this erase they synced contacts if I do this? (Contacts are what are most important in this case; there is no music stored, for the backup had no music.) If it does, can I prevent this from happening without having to manually replace the contacts?

    You did not restore the new iPhone.
    The first time a new iPhone is connected to iTunes on a computer that is used to sync with another iPhone or iOS device or that was used to backup another iPhone or iOS devide, you are prompted to transfer the backup for the other iPhone or iOS device, or set up the new iPhone as a new iPhone.
    Since the old iPhone was synced with iTunes on a different computer, all iTunes content on the new iPhone (which is none at the present time) will be erased first.
    The warning message should indicate all iTunes content will be erased from the iPhone, which is iTunes content only.
    If you are syncing contacts with a supported address book app on this computer and the supported address book app on this computer includes any contacts, you will be provided a merge prompt for the contacts, which you want to select. Otherwise the contacts on the iPhone will be replaced with the contacts in the address book app on the computer with the first sync.

  • Why can't you trim or merge (pathfinder) a gradient?

    Whenever I try to trim or merge a gradient it only divides it, but when it's solid it works. Why? I'm trying to trim/merge some artwork with a lot of gradients and it's making it impossible. If anyone knows of a way to do this with gradients please let me know. Here is an image of what I'm talking about showing it working with solids, but not gradients.
    <a href='http://postimg.org/image/6oew6ezdr/' target='_blank'><img src='http://s11.postimg.org/6oew6ezdr/trim.jpg' border='0' alt="trim" /></a>

    Yes I mean why can't you trim or merge a gradient object (not mesh gradient) like a solid object? Both are objects and both get split in some way without effecting the gradient itself (besides splitting the object of course). So why is it that it only allows gradient objects to basically be divided only, but not merged or trimmed.  It seems like it should work, but for some reason is treats solid objects as solid objects and gradients objects as solid objects with overprint fill applied. I really wish Adobe would address this as it doesn't make sense to clip out the gradient area if the gradient isn't required to change. What's the point of having the trim or merge if it only divides it? What's the point of leaving objects underneath the gradient? It just seems to defeat the purpose of both operations.
    For anyone else following this thread the way to workaround this is by copying each gradient, pasting behind (ctrl+b) and then changing it to a solid color that is not in the design. Once you trim or merge you can select same fill color to delete the solid color from underneath and then you are just left with the gradient properly trim/merged. The bad news is this is super time intensive if you have 100s of gradients on multiple different levels as paste behind pastes only directly behind the object you had selected, so if your order is not perfect some objects will actually paste in front which you don't want.
    Alternatively you could trim or merge everything and then select same fill color and then reunite each gradient, but that changes the gradient position itself so you'll have to reapply the correct angle, etc to each gradient which again is time consuming.
    For all those wondering why do I need to be able to do this. I work with spot colors which have to be trapped correctly with gradients. This requires overlapping gradients and doing overprint fills to make sure they blend properly. If I trim/merge the gradient objects if puts lines through the gradient that shows up in print and makes it more difficult to apply the underlaying color correctly.

  • Where can I download CrstalReport 9 merge modules?

    Hi,
    I connect to http://support.crystaldecisions.com/downloads to get CrystalReport 9 merge module, but I failed to login.
    Where can I get CrystalReport 9 merge module?
    Thanks.

    Also, all runtime for all versions of CR (Since v. 9) are notes in [this|https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567] wiki.
    Chuck, thank you for jumping in
    Ludek

  • I have an export pdf account that i paid for - close to $100. never used it. now adobe acrobat can't recognize me and merge accounts?

    Why can't the accounts be merged and also be credited for what i paid to this already.?

    Hi tweedy41,
    Pleasesee Adobe ID, sign in, and account help. You'll need to Contact Customer Care  to have your accounts reconciled. I was able to find the account under the same email address that you use here in the forums. It looks like you ordered a subscription today, but that order hasn't processed yet.
    A Customer Care agent should be able to help you get things sorted out.
    Best,
    Sara

  • TS1702 hi i have downloaded fifa 13 from the itunes in my laptop to put it in the ipad 2 but when i come to sync it it says fifa 13 failed instillation the problem is that i paid money for that game so like how can i resolve this problem

    hi i have downloaded fifa 13 from the itunes in my laptop to put it in the ipad 2 but when i come to sync it it says fifa 13 failed instillation the problem is that i paid money for that game so like how can i resolve this problem, i didnt buy it with my account my friend bought it and he sended it for me so i really dont know what to do cause i didnt have a visa card so he bought it , and i paid him

    sami1958 wrote:
    ... i didnt buy it with my account my friend bought it and he sended it for me ...
    The issue is that it is tied to your friends Apple ID and not yours...
    Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID.

  • I have address book v. 6.1 in Lion. I have recently been unable to change my notes. When I type anything new, it simply disappears. How can I fix this?

    Hi
    I have address book v. 6.1 in Lion. I have recently been unable to change my notes. When I type anything new, it simply disappears. How can I fix this?
    I checked previous discussions on Address Book problems and there was a suggestion to find Library in GO. I do not see Library when I clicl Go. Can someone advise on this?

    To migrate your data to a new iCloud account go to Settings>iCloud and turn off all synced data (contacts, calendars, etc.), when prompted choose to keep the data on your phone.  After everything is set to off, scroll to the bottom and tap Delete Account.  Next, create the new iCloud account on your phone and turn on syncing for contacts, calendars, etc again.  If prompted, choose Merge.  This will upload your data to the new iCloud account.

Maybe you are looking for

  • Problem in creating a new DC

    Hi All, I have JDI installed, I imported the configuration in my NDS. Now when i 'm trying to create a new DC - My Vendor name is excelcom.com, and when i try creating a new DC its saying : syntax of "excelcom.com/test is not valid: Invalid Name ;on

  • Sound no longer working

    Last night we had a big storm. My wife's computer was asleep and when we woke up, it was frozen. We didn't lose power, but I suppose there could have been a surge of some kind. Anyway, the computer is behaving normally except for one thing: there is

  • V function and dates

    I'm very much new to APEX and I've been looking into a performance issue our external APEX app is having, so if someone has any advice I would be very grateful. I've narrowed the issue down to one page which uses a report region. This report runs an

  • How can I get Leo iCal to recognize Calenders from Tiger iCal

    During my Archive and Install of Leo onto a Tiger system, the install crapped out on a corrupted Printer driver (can't remember the exact message), but it required a restart of the install. Unfortunately, during the previous install, the install had

  • Build Q - minimizing size of applet

    hello, I'm writing a charting applet with JFreeChart, which is awesome but large. I've tried both including jfreechart.jar in the run-time libraries, and pulling out the .class files & putting them in my source folder, in the hope that Creator would