How can i relate my tables in order to get unique results

Data given below is collected from three table
ACCT_NO = 1242001063101
SYM_RUN_DATE     = 8/29/2012
ACTUAL_BALANCE = -7316.94
LEDGER_BALANCE_BASE =
CLIENT_NO     = 1240000040
PROFIT_CENTRE = 206
BRANCH_NO = 124
CURRENCY     = PKR
ACCT_TYPE = 101
DEPOSIT_TYPE     = S
ACCT_STATUS = D
OPEN_DATE = 2/19/2002
MATURITY_DATE =
ACCT_CLOSE_DATE =
CREDIT_ACCT_LEVEL_INT_RATE= 0
CR_INT_TYPE = PLS
ZAKAT_EXEMPT = N
AGG_BAL_MTD =-212191.26
AGG_BAL_QTD = -439016.4
AGG_BAL_YTD = -1739732.19
the data of Fourth table look like this:
Sym_run_date = 30-AUG-12
Int-type = 7d2
Effect_date = 02-NOV-09
Balance = 123321232.23
CCY = USD
Actual Rate = 5
Problem : the main problem is that i want to collect the data from above three tables and as well as the relating data of the fourth table but fourth table is giving me more than one records
for example : ACCT_NO: 1242001063101 has multiple records in the fourth table with same effect_date (means two records found of that account of same effect_date)

This way.
with data as
select 'PLS' prod,      9999 bal,           6 rate from dual union all
select 'PLS',      99999,           6 from dual union all
select 'FP4',      5000,           5 from dual union all
select 'FP4',      10000,           6 from dual union all
select 'FP4',      50000,           6.7 from dual union all
select 'FP5',      50000,           6.9 from dual
select  rn, prod, bal,
        case when
                rn = 1
              then
                0
              else
                lag(bal) over (partition by prod order by bal)
        end from_bal,
        bal to_bal,
        rate rate
  from  (
          select prod, bal, rate, row_number() over (partition by prod order by bal) rn
            from data
        ) a
order by prod;
RN  PROD      BAL      FROM_BAL TO_BAL   RATE                  
1     FP4     5000     0     5000     5
2     FP4     10000     5000     10000     6
3     FP4     50000     10000     50000     6.7
1     FP5     50000     0     50000     6.9
1     PLS     9999     0     9999     6
2     PLS     99999     9999     99999     6

Similar Messages

  • How can i relate the input parameters to table MARD

    Hi,
    I have inputs as material number , sales organization , distribution chanel and plant , using this i have query the table MARD . in MARD table material number and plant is available , how can i relate sales organization and distribution chanel to query the table, please help.
    Regards,
    Ratheesh

    Hi,
    Try tabel MVKE, that contains sales data, table MARD is SLoc specific data for material.
    http://www.erpgenie.com/abap/tables_mm.htm
    Regards,
    Csaba

  • In Function  'MD_STOCK_REQUIREMENTS_LIST_API', how can i relate the order?

    In Function  'MD_STOCK_REQUIREMENTS_LIST_API'
    we will get the material requirment order No. and their sub soure order No.
    Fox example
    if i find a PR, then i will also see 2 PRs as it's sub source.
    But how can i relate the orders from function 'MD_STOCK_REQUIREMENTS_LIST_API'?
    TKS a million~~

    Hi,
    Can you please explain your need with a clear example, from your initial posting it is not quite clear what you're trying to link.
    Regards,
    Vivek

  • How can I tell what table(s) have the most transactions against them

    Hello, in Oracle 11.2.0.3, RHEL 6 x86-64, how can I tell what tables have the highest transaction activity?
    Picked "Objects" because I could not find a space related to performance tuning
    Humbly,

    What version of Oracle are you running (standard or enterprise)?
    Easist system is to run an AWR or statspack report. If you run either of these you will see sections on segments (so segments by logical reads, physical reads) which is easily digestible.
    v$segment_statistics will also give you a breakdown on segment access.

  • How can I use the field "Sales Order" on derivation?

    Dear All.
    This is about PA characteristic derivation.
    I want to change the characteristic value "Sales Order (KAUFN)" by derivation.
    But I cannot select the characteristic field on target field.
    The field "Sales order(KAUFN)" doesn't exist there.
    Why? How can I use the field "Sales Order" on derivation?
    Y.C.Bae

    Hi Bae,
    in order to be able to choose fields KAUFN (for sales order) and KDPOS
    (for sales order item) as target fields of derivation step 'enhancement'
    you have to modify the coding of subroutine EXIT  GET_ALLOWED_TARGETS
    in program RKEDRCOPA like this:
        NAME-IDENTIFIER = 'CO-PA'.
        NAME-TABNAME = FIELDTAB_ENTRY-TABNAME.
        NAME-FIELDNAME = FIELDTAB_ENTRY-FIELDNAME.
        IF FIELDTAB_ENTRY-USGFL CA 'DUV'
    BEGIN OF INSERTION *****
             OR FIELDTAB_ENTRY-FIELDNAME = 'KAUFN'
             OR FIELDTAB_ENTRY-FIELDNAME = 'KDPOS'
    END   OF INSERTION *****
             OR FIELDTAB_ENTRY-FIELDNAME = 'KNDNR'
             OR FIELDTAB_ENTRY-FIELDNAME = 'ARTNR'
    Actually sales order number and sales order item shouldn't be changed
    by derivation (therefore they are no valid target fields in standard)
    but if you need to fill them within an enhancement this modification
    will help you to define them as valid target fields. But this is just
    the technical frame so far; the logic from which table you'd like to
    derive the sales order number correctly depends on your implementation
    of the enhancement! I just want to ask you to be rather careful with
    the implementation of the exit so that the sales order number isn't
    changed in cases that shouldn't be concerned.
    Regards,
    Abhisek

  • How can i see the Asset purchase order & GR after settlement

    Hello Gurus,
    Would you please tell me how can i check the Asset Purchase order, which is settled (WBS Element)? How can i see the GR document for the specific asset? & if i treat as a expeneses toward the project where i get the GR/ PO in asset explorer?
    Warm Regards,
    Dhananjay Rahane.

    Dear,
    Dhanajay.
    Purchase order related to asset you can see in Asset Master itself. Go to AS03 - Environment  ( Menu bar ) - Click on Purchase Order. Here you will have all the relevant PO's relating to asset.
    GR you can see in PO at a Purchase Order history. The data relating to asset you can  see in left hand side navigation in AW01N Asset Explorer. Like as Vendor, PO's, etc.
    WBS in PO you can see in Account Assignment Tab if your PO is created with N. ( Network PO ). WBS linked to Network you can see in CJ20N ( Project Builder ). 
    WBS Actual values can see in report CJI3 Actual Cost & Revenues.
    I hope this helps you to solve your issue. If you have any doubts feel free to share.
    Regards,
    Pankaj A Bhalerao.

  • How can i know the table fragments

    Hi
    How can i know the table is fragmented.
    Thank you

    If you're in 10g you could try use the Segment Advisor to identify various issues etc with your table. This will also provide recommendations on how to improve things.
    (below script shamelessly stolen from the brilliant Oracle Base website)
    -- segment_adv_table.sql
    -- Use Segment Advisor to analyse a table.
    -- Original Version
    -- http://www.oracle-base.com/articles/10g/SpaceObjectTransactionManagement10g.php
    -- owner is SCOTT
    -- table is EMP
    -- do a search/replace to change these 2 values and re-run it ;)
    DECLARE
    l_object_id NUMBER;
    BEGIN
    -- Create a segment advisor task for the SCOTT.EMP table.
    DBMS_ADVISOR.create_task (
    advisor_name => 'Segment Advisor',
    task_name => 'EMP_SEGMENT_ADVISOR',
    task_desc => 'Segment Advisor For EMP');
    DBMS_ADVISOR.create_object (
    task_name => 'EMP_SEGMENT_ADVISOR',
    object_type => 'TABLE',
    attr1 => 'SCOTT',
    attr2 => 'EMP',
    attr3 => NULL,
    attr4 => 'null',
    attr5 => NULL,
    object_id => l_object_id);
    DBMS_ADVISOR.set_task_parameter (
    task_name => 'EMP_SEGMENT_ADVISOR',
    parameter => 'RECOMMEND_ALL',
    value => 'TRUE');
    DBMS_ADVISOR.execute_task(task_name => 'EMP_SEGMENT_ADVISOR');
    END;
    -- Display the findings.
    SET LINESIZE 250
    COLUMN task_name FORMAT A20
    COLUMN object_type FORMAT A20
    COLUMN schema FORMAT A20
    COLUMN object_name FORMAT A30
    COLUMN object_name FORMAT A30
    COLUMN message FORMAT A40
    COLUMN more_info FORMAT A40
    SELECT f.task_name,
    f.impact,
    o.type AS object_type,
    o.attr1 AS schema,
    o.attr2 AS object_name,
    f.message,
    f.more_info
    FROM dba_advisor_findings f
    JOIN dba_advisor_objects o ON f.object_id = o.object_id AND f.task_name = o.task_name
    WHERE f.task_name IN ('EMP_SEGMENT_ADVISOR', 'USERS_SEGMENT_ADVISOR')
    ORDER BY f.task_name, f.impact DESC;

  • How can I find the table of

    How can I find the table of the structure fields?
    A structures table?
    for example the table of sap standard structure diaprd or diadrp, I do not remember now?
    Thanks.

    The hard way....
    Go to SE11
    Enter the structure
    Position the cursor on the field
    Press Where-Used List
    Check all related table to see which one fulfill your needs
    Greetings,
    Blag.

  • How can I make a table cell extend beyond the page?  The text disappears when the cell becomes larger than the page.

    How can I make a table cell extend beyond a page?  The text disappears when the cell becomes bigger than the page.  I want the table to continue to the next page.

    As a student, you might be able to get Office for Mac from the college bookstore at a substantial discount. Otherwise, I think your best option for documents that need to be shared with Office users is to get one of the free Office clones such as LibreOffice.

  • Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.

    Having arranged some scanned pictures in an album in I-Photo how can I keep them in the order I have chosen when I move the album. They all have the scan date and not the taken date and move to new positions if I move them from one album to another.
    Is there any way to re-number them in the order I have chosen so that they can then be sorted by number? The scans are all from pre-digital images that I wish to move to a photobook and I don't want to have to organise them twice!
    Thanks for any suggestions.

    I was a bit short, Chris, sorry. It is limited, what can be posted, when typing on an iPad.
    Now I am back on my Mac. I meant the following:  Batch Change the date for a large range of photos, that should have a date stepped in increments.
    Select all Photos at once and use the command "Photos > Batch Change".
    Then set the date for the first photo and select an increment, e.g. one minute.
    Now all photos will get a new date assigned, incremented by one minute, in the sequence you have selected. So you will be able to sort them by date.  This way it will be unnecessary to change the titles or filenames.

  • I have pictures in a folder, how can I display them in name order?

    I have pictures in a folder, how can I display them in name order?

    Welcome to the Apple Community.
    I don't think you can. You might ensure that their creation dates are in order, but I'm not so such that will help. Ordering seems to be a feature limited to use with iPhoto/Aperture.

  • HT3354 how can i use one table for reference to another

    how can i use a table for a referance to another eg when i type a word in a cell, i will like it to match the word with another table then return the information in the cell i am using

    you can use vlookup() (or any of the lookup family of functions) to locate an item based on a key value:
    Here is an example of something you can do with two tables:
    The table on the right is title "Data" and stores a list of names with age and favorite color.
    The table on the left uses the value in the first column to lookup up information in the table Data
    in the table on the left:
    B2=IFERROR(A2&" is " & VLOOKUP(A2, Data :: A:D, 2, 0)&" years old and likes the color "& VLOOKUP(A2, Data :: A:D, 3, 0), "NOT FOUND")
    I know this look complicated.  so I'll break it up into smalled pieces:
    first the "&" is called the concatenate operator and joins two strings.  like this:
    a string is a set of characters between double quotes.
    so "string 1" & "string 2" becomes "string 1string2"  or "Sam " & "Jones" becomes "Sam Jones"
    you can use cell references instead of strings directly in which case the concatenation is performed on the contents of the cells.
    so if cell A1 contains "Hi " and the cell A2 contains "There"  then A1 & A2 will result in "Hi There"
    so you could add the formula
    A3=A1 & A2
    this is short hand for select cell A3 then type everything including the A3 so that A3 contains "=A1 & A2" (omit the double quote)
    OK.  So the formula I provided concatenates several items together:
    it concatenates A2, then the string " is " then a formula, then the string " years old and likes the color " then a formula
    the two formulas (highlighted in blue) perform a lookup of the value in cell A2 in columns A thru D of the table named "Data".  If if finds the value in cell A2 in the first column of the lookup range in the table Data (column A) then it returns the value from the same row but in the second or third column.
    all that is in a function calld iserror() to trap the condition where the calue you enter in A2 does not exist in the table Data:
    You will find the Numbers users guide and function reference helpful.  You can download then from Apple here:
    http://support.apple.com/manuals/#productivitysoftware

  • How can I create a new sales order template

    Hello,
    how can I create a new sales order template in SAP CRM 7.0 (Web UI)? I want to use this sales order template in scenario ´'Mass Generation of Sales Orders via Marketing Projects'.
    Thanks for your support in advance.
    Best regards,
    anvan

    Hi,
    Did you set up this scenario? I want something similar, but I want an ERP order to be created. Do you know if that is possible? Do you have som tips?
    regards Camilla

  • How can I create a new sales order template in SAP CRM 7.0

    Hello,
    how can I create a new sales order template in SAP CRM 7.0 (Web UI)? I want to use this sales order template in scenario ´'Mass Generation of Sales Orders via Marketing Projects'.
    Thanks for your support in advance.
    Best regards,
    anvan

    Hi,
    Did you set up this scenario? I want something similar, but I want an ERP order to be created. Do you know if that is possible? Do you have som tips?
    regards Camilla

  • HT1918 I need to change my country in the itunes store, but can' do so, because of a $0.10 credit. How can I spend that money in order to change accounts.

    I need to change my country in the itunes store, but can' do so, because of a $0.10 credit. How can I spend that money in order to change accounts.

    Click here and request assistance.
    (70172)

Maybe you are looking for