1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Required logic for the below output

Discussion in 'SQL PL/SQL' started by Roopasree, Mar 11, 2017.

  1. Roopasree

    Roopasree Starter

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    10
    Location:
    Bangalore
    I request anyone to give the logic of my requirement mentioned below.


    Table 1

    Sv/cv Amt Cheque

    Sv 50k 222

    Sv 70k 333

    cv 30k 444


    Table 2:

    Mil Svamt Cvamt Svsettled Cvsettled

    M1 1L 1L 1L 30k
    M2 1L 1L 20k
    M3 1L 1L


    Based on table 1, sv/cv settled is filled from sv/cv column. Total SV value is 120K which is divided into m1 and m2 using sv amt reference and similarly also for cv case also.



    Based on above two tables, I want to get the output as like below table.

    Please give me the logic either in sql/plsql

    Mil Sv/cv amt Cheque sv/cv Sv/cv settled amt

    M1 1L 222 sv 50k

    M1 1L 333 sv 50k

    M2 1L 333 sv 20k

    M1 1L 444 cv 30k
     

    Attached Files:

  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,485
    Likes Received:
    355
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You have the 'logic' if your description of how these values are to be calculated is even close to understandable (which, unfortunately, it isn't as you haven't provided an example calculation to show what your description actually means). What, exactly, is it you want? We won't write your code for you, that's your job.

    If you provide an example calculation we can see HOW this is done and possibly suggest ways for you to write the query. We really can't provide much with what you've given so far.