Update the previous records for the same customer.

Hi All,
I want to update the columns when the status = 'Processed'. And for the last 4 months.
Create table
cust_loans
( cust_id number(12),
  year_month  varchar2(20),
  status varchar2(20),
  c_info varchar2(20)      
  address varchar2(20),
  loan_type varchar2(20),
  vin_num varchar2(20)     
cust_id        year_month     Status       c_info       address       loan_type        vin_num
456789     201005                             W               
456789     201006                             N               
456789     201007                             Y               
456789     201008                             Y               
456789     201009                             N               
456789     201010     Processed                              Austin     Auto     ajkd3323
456789     201011     Processed                              Austin     Auto     ajkd3324
456789     201012     Processed                             Austin     Auto     ajkd3325
256712     201005                            W               
256712     201006                            N               
256712     201007                            Y               
256712     201008                            Y               
256712     201009                            N               
256712     201010                            Y               
256712     201011     Processed                         Minnesota     Auto     erer334
256712     201012     Processed                         Minnesota     Auto     erer335
Output Expected     
456789     201005                           W               
456789     201006                           N                  Austin     Auto     ajkd3323
456789     201007                           Y                  Austin     Auto     ajkd3324
456789     201008                           Y                 Austin     Auto     ajkd3325
456789     201009                           N                 Austin     Auto     ajkd3326
456789     201010     Processed                                                     Auto                    ajkd3323
456789     201011     Processed                                     Austin     Auto                     ajkd3324
456789     201012     Processed                                      Austin     Auto                     ajkd3325
256712     201005                          W               
256712     201006                          N               
256712     201007                          Y             Minnesota     Auto     erer334
256712     201008                          Y            Minnesota     Auto     erer335
256712     201009                          N            Minnesota     Auto     erer336
256712     201010                          Y            Minnesota     Auto     erer337
256712     201011     Processed                                 Minnesota    Auto                     erer334
256712     201012     Processed                                 Minnesota   Auto                    erer335Thanks.
Edited by: AJR on Mar 26, 2011 12:03 PM
Edited by: AJR on Mar 26, 2011 12:03 PM

Hi Try this and see if you get your output,
UPDATE cust_loans cl1
   SET vin_num = NVL ((SELECT vin_num FROM (SELECT * FROM (SELECT year_month,cust_id,vin_num
                                                                 ,MIN (year_month) OVER (PARTITION BY cust_id) ym
                                                    FROM cust_loans WHERE status = 'Processed')
                                            WHERE year_month = ym) cl2
               WHERE cl1.cust_id = cl2.cust_id AND cl1.c_info IN ('Y', 'N')
                     AND TO_DATE (cl1.year_month, 'YYYYMM') >= ADD_MONTHS (TO_DATE (cl2.year_month, 'YYYYMM'), -4)
                     AND TO_DATE (cl1.year_month, 'YYYYMM') <  TO_DATE (cl2.year_month, 'YYYYMM')),cl1.vin_num)
WHERE cl1.year_month > (SELECT NVL (MAX (year_month), cl1.year_month)
                           FROM cust_loans cl3
                          WHERE NVL (c_info, 'W') = 'W' AND NVL (status, 'x') != 'Processed' AND cl1.cust_id = cl3.cust_id)
AND NVL (status, 'x') != 'Processed'G.

Similar Messages

  • I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    I am changing from Word to Pages. I have created my custom template with all my styles etc and that is what comes up when I go for a New Document. Fine. How do I get it to use the same Custom Template when I use Pages to open a Word document?

    The template is a document in itself, it is not applied to an existing document whether it is a Pages document or a Word document converted to a Pages document.
    You would need to either copy and paste content, using existing styles, or apply the styles to the converted Word document.
    You can Import the Styles from an existing document and those imported Styles can be used to override the current document's styles:
    Menu > Format > Import Styles
    The process is simplified if the styles use the same names, otherwise you will need to delete the style you don't want and replace it with the one that you do want when asked, then the substitution is pretty straightforward.
    Peter

  • HT1338 i have apps to be updated but when i try to update them a message pops out saying "You have updates for other accounts, please sigh in with the other id". Can some one help me how can i still update the same with the new apple id ive created.

    i have apps to be updated but when i try to update them a message pops out saying "You have updates for other accounts, please sigh in with the other id". Can some one help me how can i still update the same with the new apple id ive created. As i dont have the access to the earlier id anymore.

    You cannot. The apps are assigned to that Apple ID and there is nothing you can do to change that. You could choose to download them again with the new Apple ID, any paid apps will need to be purchased again.
    Hope that helps.

  • Multiple address for the same customer code

    Hi,
    Suppose we have a customer name XYZ LTD whose sap code is 123.
    Now user want to maintain multiple addresses for the same customer in the same code.So that during billing he can have option to chose one of the address in which he want to sent the invoice.
    Is it posible if yes then let me know.
    Thanks in advance.
    Regards,
    SATYA

    Hi Satya,
    you can define for a vendor/customer several partner functions with different        
    adresses. You can create certain partner roles several times.               
    If you create a purchase order, than you can choose the wanted              
    address and partnerrole on the header level. In the standard system you     
    can use the patner role 'OA' ordering address and for the finance           
    the 'IP' Invoice presented by.
    I hope I was able to help you.
    Kind regards,
    Zsuzsanna

  • Multiple Partners for the same customer in Message tracking of SEEBURGER

    Hi,
    This is for third party customers which use EDI messages. We have for one customer multiple partner numbers configured in Partner profile. I would like to know while configuring the trading partners in SEEBURGER Message Tracking, can we have multiple keys for the same customer for multiple partners for an INVOIC02. Like the following keys:
    12345_INVOIC02
    34567_INVOIC02
    45678_INVOIC02

    Hi Satya,
    you can define for a vendor/customer several partner functions with different        
    adresses. You can create certain partner roles several times.               
    If you create a purchase order, than you can choose the wanted              
    address and partnerrole on the header level. In the standard system you     
    can use the patner role 'OA' ordering address and for the finance           
    the 'IP' Invoice presented by.
    I hope I was able to help you.
    Kind regards,
    Zsuzsanna

  • Count no. of records for a particular customer in the query?

    Hi,
    1)Can anybody guide as to how do we count the number of records for a particular customer. E.g.
    C1 has placed 2 orders
    C2 has placed 4 orders
    C3 has placed 5 orders
    so in all the ODS has 11 records. Now while designing the query we need to ensure that we show only the Customers who have placed more than 3 orders. What could be logic to solve this kind of a problem?
    2) Is there a way that we can access the structure and data of the ODS in ABAP code say one of the includes in a user exit?
    The requirement says there could be N number of cases opened and closed in one month. Now we need to calculate the average number of days taken to close a case? Any ideas on the possible solution.
    Thanks
    RB

    Hi Rajat,
      Take a calculated key figure rename it as Count , go to the properties of that calculated key figure on the left hand side not at the columns side in the properties click on the button Enhance which is shown in the down left side, in the exception aggregation part select "count all values <>0" , take the reference character as customer Id . Now go to the Customer character which is in rows go to properties and select  "Normalise to" combo box  in that select "Query result" now u will get the exact result which ur looking for .

  • Excisable and Non Excisable plants for the same customer and same material

    Hi All,
    We have a customer who purchases the SAME goods from two different plants, one plant is Excisable and another plant is Non Excisable. So sales area of the customer is same for both the plants. When customer buys from Excisable plant Excise Duties should applicable and when the same customer buys from Non Excisable plant Excise Duties should not be applicable. If I maintain the Excise indicator as 1 in customer's J1ID then Excise Duties are applicable for the customer from wherever he buys the goods.(If he buys the goods from Excisable and Non Excisable plants Excise Duties are flowing).
    So, my query is: if the customer buys from non-Excisable plant, Excise Duties should not flow.
    So I am planning to create a new sales org for Non Excisable plant, then the sales area of the customer will change.
    Is there any other way to over come this issue? Plz guide me.
    Thanx&Regards,
    RAMU

    Dear Ramu
    My suggestion is creating a new sales organization is not  required just to fulfill this excise requirement.
    Let us assume you have two plants
    -  1000 is excisable and
    -  2000 is non excisable
    for material ABC
    Now go to J1ID, select the tab "Material and Chapter ID combination"  and maintain the excise tax indicator for plant 1000 only.
    By doing so, while creating sale order, you input the delivering plant and based on the settings you maintained in J1ID, excise duty will be determined in that sale order.
    thanks
    G. Lakshmipathi

  • HT1338 My Update for OS 10.8.4 is not updating. The update app keeps saying to update the same information and it never updates.  Help

    My Update for OS 10.8.4 is not updating. The update app keeps saying to update the same information and it never updates.  Help

    Exactly the same for me.  Have tried to update three times and my iMac has restarted (after apparently downloading the update) but the update has not been installed.
    My iMac is still at 10.8.3.

  • Credit limits for the same Customer for different countries.

    Hi SAP Gurus,
    A customer belongs to 2 different countries, the credit limits are maintained  in FD32 for one country.
    But basing on the "country" the credit limits should change for the same customer.
    So how we need to handle FD32 in this scenario. Is there any option to maintain credit limits basing on the "Country"?
    Thanks and Regards
    Sunil
    Edited by: Sunil.kds on May 27, 2011 9:37 AM

    Hi ,
         sales area wise , you can differentiate the credit limit . In this case , you can have one more credit control area and assign it to new sales area. it the same customer comes under diff country , extend the customer  to the new sales area . By doing so, you can have 2 credit limits for the same customer.
    With Regards
    S.Siva

  • Updating the same row in different sessions

    Hi,
    I've one table application(appl_no varchar2(10), locked_user varchar2(8)) which is used to track which user is logged in at present.
    As soon as any user is logged in to the system via front end, the user ID is populated to locked_user column so that no other user cannot access the same appl_no. As soon as the user exits from the front end, the locked_user is updated to null.
    We've experiencing a strange behaviour in our system where one user exits from front end and at the same time(previous transaction is not committed) the same user ID opens the same application in another session, but the session session doesn't gets hanged(waiting for the lock to be released) and tries to update the same row which was locked by first user's session. We come to know this thing when the trigger on the table gets fired in both sessoins.
    Now I want to know if there is any locking machanism in Oracle where the same row can be updated in 2 different sessons one after another when the first session has not committed its changes?
    Thanks
    Deepak

    And obviously no two sessions can update the same record at the same time
    Yes I know that and I tried the same thing by myself on 2 different sql sessions which is not happening, but this is happening when the same is being done from front end(Power Builder based application).
    Just wanted to check is there any possibility where this can be possible?
    Thanks
    Deepak

  • Two Infopath forms to submit or update the same sharepoint list

    Hi, I'm building a request SharePoint site so users can submit a request from a simplified InfoPath form (with only 5 out of 10 fields), but support personnel can open the form and then see all 10 fields.  For the list view, I know I can create custom
    views when user's see the list.  But when they open an item, I only want them to see the fields they entered and not the other fields the support personnel can see.  So I guess my question is: can I create two InfoPath forms to update one list or
    can I create an InfoPath form that has two views so one view suppresses fields and the other does not (based on permissions perhaps).

    Hi Darby,
    I would suggest creating two views, instead of two forms. Views can be shown/hidden based on the logged in users, takes few rules to configure based on the logged in users. you can also explore web service to get the users from groups to show/hide based
    on the user group, little overhead but give more control due to the fact of one single form.
    Two forms will be bit complex, if you want to update the same rows of information.
    here are some references -
    http://blogs.technet.com/b/anneste/archive/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010.aspx
    http://claytoncobb.wordpress.com/2009/06/21/userprofileservice-extended/
    http://sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?List=daba3a3b%2Dc338%2D41d8%2Dbf52%2Dcd897d000cf3&ID=80&Web=dbb90e85%2Db54c%2D49f4%2D8e97%2D6d8258116ca0
    http://office.microsoft.com/en-us/infopath-help/add-delete-and-switch-views-pages-in-a-form-HA101732801.aspx
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How can we map the same customer as vendor also

    Hi,
    For suppose we have a senario like where the same customer act as a Vendor. Then how do we map this senario..
    Regards
    sankar

    Dear sankar
    As already suggested, create the client as a customer in XD01 and save.  Similarly, go to XK01 and create the same customer as vendor and save.  Assign the respective customer code in vendor master and vendor code in customer master.
    Wherever MM activities takes place like receiving bottles via MIGO, payment will made based on MIRO.  Similarly, from SD side, whenever soft drinks is sold, the amount gets debited to that customer account. 
    Both these transactions are recorded in FBL5N.
    Hope this is what your doubt is.
    thanks
    G. Lakshmipathi

  • Multiple users updates the same data - RowInconsistentException

    Hi,
    I'm using JDeveloper 11.1.2.1
    Locking mode: optimistic
    Scenario:
    - Have 2 users (user 1 & user 2) running application x
    - Both users updates the same record
    - user 1 hits save first (and hence no error)
    - user 2 hits save after user 1, and gets RowInconsistentException
    I have managed to trap the exception in the EntityImpl class:
    public void lock() {
    try {
    super.lock();
    catch (RowInconsistentException ex) {
    this.refresh(REFRESH_UNDO_CHANGES);
    super.lock();
    But what this does is that it just refreshed the entities and removed user 2's work without notification, which isn't acceptable.
    Instead of this, is it possible to display an error message in user 2's UI (instead of the stack error) , refresh the entities, but keep user's 2 work, and possibly recommit?
    Thank You
    Regards,
    Andi

    Andi,
    , is it possible to display an error message in user 2's UI (instead of the stack error)You can customise the error handling, yes, to display a different message if you like (check out the Fusion Developer's Guide to find out how)
    refresh the entities, but keep user's 2 workNot sure what you mean there
    By default (at least it used to be this way, haven't checked recently), if you commit again after receiving the "row inconsistent" error, it will save user 2's changes (potentially overwriting user 1's changes)
    John

  • How to prevent multiple users from updating the same data in coherence

    Hi,
    I have a Java Web Application and for data cache am using coherence 3.5. The same data maybe shared by multiple users which maybe in hundreds. Now how do I prevent multiple users from updating the same data in coherence i.e. is there something in coherence that will only allow one user a time to update. If one user is in a process of updating a data in coherence and some other user also tries to update then the second user should get an error.
    Thanks

    I have a question on the same line. How can I restrict someone from updating a cache value when I a process is already working on it. I tried locking the cache key but it does not stop other process to update it , it only does not allow other process to get lock on it.

  • Insert a field and update the same row.

    Hi,
    I am inserting a value in a row.
    And later within a cursor loop I am trying to update the same row. But it is not working....
    CREATE OR REPLACE procedure Del_Note_stage
    Is
    v_delNote Delivery_Note.Delivery_Note_id%type;
    Cursor C1 is Select Heading_Name,File_Data from Sqlload_Stage;
    Begin
    dbms_output.put_line('i am here a ');
    Select Delivery_Note_Id_Seq.nextval into v_delNote from dual;
    Insert into DELIVERY_NOTE_STAGING(Delivery_Note_ID,LUT,LUB,PROCESSED) Values(v_delNote,sysdate,'Config','N');
    commit;
    dbms_output.put_line('i am here b'||v_delNote);
    For sqlload_rec in C1
       Loop
        dbms_output.put_line(sqlload_rec.Heading_Name);
        dbms_output.put_line('Del Note Id is :'||v_delNote);
        update DELIVERY_NOTE_STAGING  set deployed_by='TOM' where delivery_note_id=v_delNote;
    End loop;
    End;

    But it is not working....Why not?
    Please read: http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    Why are you updating after inserting?
    Just add deployed_by to the insert statement, or use a default value for that column.
    Also you don't need to select your Delivery_Note_Id_Seq.nextval from dual, just use it in your insert statement.
    Something like:
    Insert into DELIVERY_NOTE_STAGING(Delivery_Note_ID,LUT,LUB,PROCESSED,deployed_by )
    Values( Delivery_Note_Id_Seq.nextval,sysdate,'Config','N', 'TOM' /*or USER*/);

  • Possible? two users/computers to share and update the same calendar?

    We would like to have two people update the same calendar. How is this possible? Subscribers can't update?
    Thanks

    In short it isn't possible (currently). Subscribers cannot edit a calendar they subscribe to - it is read-only.
    See this thread for more detail: http://discussions.apple.com/thread.jspa?threadID=705054&tstart=45

Maybe you are looking for

  • Previewing loops

    Have had no luck with PCs trying to do music recoding so I swithced over to Mac because I heard it so easy, seamless, and problem free. Now, on opening Garageband for the first time and trying to preview loops I get an error mesage that says: "the so

  • IPhoto6 won't start up after install.  Icon bounces 2-3 times and stops.

    I have a Mac G4 800 MHz iBook with OS 10.3.9. I just bought iLife 06 and installed the entire package. Every iLfe application but i-Photo 6.06 starts up and works. When I click on the iPhoto icon in applications, the Icon appears on the tray, bounces

  • Network-related or Instance-specfic error when attempting remote connection from SSMS

    Hello, I have installed SQL Server express on a Win7 desktop and want to connect to it via SSMS on a laptop. I have set up a SQL login on the desktop so I can login, but when I try to connect to the instance from the laptop via SSMS I get the error 2

  • Updating Problems with CS5

    I'm trying to update my CS5.  Gives me error message, "updates failed to install.  There was an error downloading these updates.  Please try again later."  It does this every time I try to update.U

  • Adobe premier elements 12 will not open.

    Hi My Adobe Premier Elements 12 will not open. It did open about 12 hours ago when I was busy working on video edits. Then I closed it, went to sleep and got up in the morning to carry on editing - bt it wont open anymore. There are no error messages