Need help with Query to determine Credit Memos and Invoices

Hi All
Thanks for all the help here.
I need a query to determine any credits or invoices issued within a given period.
OINV and ORIN with UNION ALL?
Please advise any help.
Thank you!

Hi Daniel,
Please check below Query.
SELECT T0.[DocNum] as 'Invice No', T0.[DocDate] as 'Invoice Date', T0.[CardName] as 'Invoiced Customer', T3.[DocNum] as 'Credit Memo No', T3.[DocDate] as 'Credit Mamo Date', T3.[CardName] as 'Credit Memo Customer' FROM OINV T0  LEFT JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] LEFT JOIN RIN1 T2 ON T2.[BaseEntry] = T1.[DocEntry] AND T2.[BaseLine] =  T1.[LineNum] LEFT JOIN ORIN T3 ON T2.[DocEntry] = T3.[DocEntry] WHERE T0.[DocDate]  >=[%3]  AND   T0.[DocDate] <=[%4]
Hope this helps
Regards::::
Atul Chakraborty

Similar Messages

  • How to determine the credit memo and invoice in table RBKP?

    Hi all,
    I want to specific the credit Memo and invoice in the table RBKP using MIRO.
    Does any body know that any field can be specific that ?
    Regards,
    Luke

    Hello
    The Field  XRECH - Invoice will be populated with an "x" if it is an invoice else will be blank if it is a credit memo in the  table RBKP.
    Regards
    Anis

  • Need help with my iTunes on iPhone 5 and Macbook Pro

    Need help with my iPhone 5 and my Macbook Pro.  I was purchased some music on itunes at my mac. Some reason I deleted those music from both on Mac and iPhone 5.  Today, I went to my iPhone iTunes store inside of iCloud to redownload my puchased. But those song won't able to sync back to my iTunes library on my Mac.  Can anyone help me with that ??....

    You've posted to the iTunes Match forum, which your question does not appear to be related to. You'll get better support responses by posting to either the iTunes for Mac or iTunes for Windows forum. Which ever is more appropriate for your situation.

  • Credit memo and invoice

    Hi everybody,
    I post a credit memo and I want to match it with invoice.
    Please tell me how to do it
    Thank so much
    Minh

    Hi every body
    I post credit memos referred to a specific invoice. I cross reference my invoice to my credit memo on the 'Inv. Ref' field at the payment tab strip.
    Although I post it w/ clearing the invoice using F-04 choose 'transfer posting w/ clearing', but I pay my invoice, it doesn't give me the net amount.
    I post credit memos referred to a specific invoice. I want when I pay my invoice, it will give you the net amount. How can I do?
    Please tell me how to configure
    Thank in advance
    Minh
    Edited by: Tran Binh Minh on Jun 23, 2008 5:51 AM

  • Need help with Query

    Hi,
    Good day everyone! I need help writing a query. I have this table with the following data in them...
    ACCT_CODE  FSYR      YTD_AMT
    A123            11          100  
    A456            11          200
    A123            10          50
    A456            10          100I want the output to look like this:
    ACCT_CODE     CURRENT_YEAR(11)       PRIOR_YEAR(10)
    A123               100                              50
    A456               200                              100The user will input the fiscal year and based on that input, I want to get the prior year value as well.
    Thank you for all your help!!
    Edited by: user5737516 on Jun 29, 2011 6:48 AM
    Edited by: user5737516 on Jun 29, 2011 6:50 AM

    user5737516 wrote:
    Hi,
    Good day everyone! I need help writing a query. I have this table with the following data in them...
    ACCT_CODE FSYR YTD_AMT
    A123 11 100
    A456 11 200
    A123 10 50
    A456 10 100
    I want the output to look like this:
    ACCT_CODE CURRENT_YEAR PRIOR_YEAR
    A123 100 50
    A456 200 100
    The user will input the fiscal year and based on that input, I want to get the prior year value as well.
    Thank you for all your help!!what is prior year?

  • Need help with query joining several tables into a single return line

    what i have:
    tableA:
    puid, task
    id0, task0
    id1, task1
    id2, task2
    tableB:
    puid, seq, state
    id0, 0, foo
    id0, 1, bar
    id0, 2, me
    id1, 0, foo
    id2, 0, foo
    id2, 1, bar
    tableC:
    puid, seq, date
    id0, 0, 12/21
    id0, 1, 12/22
    id0, 2, 12/22
    id1, 0, 12/23
    id2, 0, 12/22
    id2, 1, 12/23
    what i'd like to return:
    id0, task0, 12/21, 12/22, 12/22
    id1, task1, 12/23, N/A, N/A
    id2, task2, 12/22, 12/23, N/A
    N/A doesn't mean return the string "N/A"... it just means there was no value, so we don't need anything in this column (null?)
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line...
    id0, task0, 12/21
    id0, task0, 12/22
    id0, task0, 12/23
    id1, task1, 12/23
    is this possible fairly easily?
    Edited by: user9979830 on Mar 29, 2011 10:53 AM
    Edited by: user9979830 on Mar 29, 2011 10:58 AM

    Hi,
    Welcome to the forum!
    user9979830 wrote:
    what i have:...Thanks for posting that so clearly!
    Whenever you have a question, it's even better if you post CREATE TABLE and INSERT statements for your sample data, like this:
    CREATE TABLE     tablea
    (       puid     VARCHAR2 (5)
    ,     task     VARCHAR2 (5)
    INSERT INTO tablea (puid, task) VALUES ('id0',  'task0');
    INSERT INTO tablea (puid, task) VALUES ('id1',  'task1');
    INSERT INTO tablea (puid, task) VALUES ('id2',  'task2');
    CREATE TABLE     tablec
    (       puid     VARCHAR2 (5)
    ,     seq     NUMBER (3)
    ,     dt     DATE          -- DATE is not a good column name
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  0,  DATE '2010-12-21');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  1,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  2,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id1',  0,  DATE '2010-12-23');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  0,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  1,  DATE '2010-12-23');This way, people can re-create the problem and test their ideas.
    It doesn't look like tableb plays any role in this problem, so I didn't post it.
    Explain how you get the results from that data. For example, why do you want this row in the results:
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/21/2010 12/22/2010 12/22/2010rather than, say
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/22/2010 12/21/2010 12/22/2010? Does 12/21 have to go in the first column because it is the earliest date, or is it because 12/21 is related to the lowest seq value? Or do you even care about the order, just as long as all 3 dates are shown?
    Always say what version of Oracle you're uisng. The query below will work in Oracle 9 (and up), but starting in Oracle 11, the SELECT ... PIVOT feature could help you.
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line... Condensing the output, so that there's only one line for each puid, sounds like a job for "GROUP BY puid":
    WITH     got_r_num     AS
         SELECT     puid
         ,     dt
         ,     ROW_NUMBER () OVER ( PARTITION BY  puid
                                   ORDER BY          seq          -- and/or dt
                           )         AS r_num
         FROM    tablec
    --     WHERE     ...     -- If you need any filtering, put it here
    SELECT       a.puid
    ,       a.task
    ,       MIN (CASE WHEN r.r_num = 1 THEN r.dt END)     AS dt1
    ,       MIN (CASE WHEN r.r_num = 2 THEN r.dt END)     AS dt2
    ,       MIN (CASE WHEN r.r_num = 3 THEN r.dt END)     AS dt3
    ,       MIN (CASE WHEN r.r_num = 4 THEN r.dt END)     AS dt4
    FROM       tablea    a
    JOIN       got_r_num r  ON   a.puid  = r.puid
    GROUP BY  a.puid
    ,            a.task
    ORDER BY  a.puid
    ;I'm guessing that you want the dates arranged by seq; that is, for each puid, the date related to the lowest seq comes first, regardless of whther that date is the earliest date for that puid or not. If that's not what you need, then change the analytic ORDER BY clause.
    This does not assume that the seq values are always consecutive integers (0, 1, 2, ...) for each puid. You can skip, or even duplicate values. However, if the values are always consecutive integers, starting from 0, then you could simplify this. You won't need a sub-query at all; just use seq instead of r_num in the main query.
    Here's the output I got from the query above:
    PUID  TASK  DT1        DT2        DT3        DT4
    id0   task0 12/21/2010 12/22/2010 12/22/2010
    id1   task1 12/23/2010
    id2   task2 12/22/2010 12/23/2010As posted, the query will display the first 4 dts for each puid.
    If there are fewer than 4 dts for a puid, the query will still work. It will leave some columns NULL at the end.
    If there are more than 4 dts for a puid, the query will still work. It will display the first 4, and ignore the others.
    There's nothing special about the number 4; you could make it 3, or 5, or 35, but whatever number you choose, you have to hard-code that many columns into the query, and always get that many columns of output.
    For various ways to deal with a variable number of pivoted coolumns, see the following thread:
    PL/SQL
    This question actually doesn't have anything to do with SQL*Plus; it's strictly a SQL question, and SQL questions are best posted on the "SQL and PL/SQL" forum:
    PL/SQL
    If you're not sure whether a question is more of a SQL question or a SQL*Plus question, then post it on the SQL forum. Many more people pay attention to that forum than to this one.

  • Need help with Soundblaster Live! 5.1 and King Theatre 5.1 speake

    Hi,
    First time ost and need some help.
    Ok i bought a nice Soundblaster Li've! 5. sound card around a month ago. 2 days ago i bought myself som speakers "Kingtheatre 5." I doubt it any of you have ever heard of this brand, i bought speakers from local shop. Ok this is where the problems start. When i try to connect the speakers i can only ever get 4 out of 5 satelites to work and the subwoofer. If i change the wiring around, i will only ever have 4 speakers working at a time. Can anyone help me with the connecting. In the back of the subwoofer i have 3 cables, one says "Centre/subwoofer" the other says "Input | surround L/R" with the word Input on the side of it, and the last one says "Front L/R(Stereo)". At the back of my soundcard i have the following colour plug ins (sorry im only 4, im not used to technical terms) Ok from left to right black, green,pink(mic),blue and a orange/brownie colour. Can anyone help with the pluging it part.
    Cheers, sorry about the long post.

    Dooda,
    If you can post a link for the layout diagram of your speaker system then it will be great.
    From your description, you could try this. Connect the audio cable from subwoofer "Front L/R(Stereo)" to Green jack on the sound card, "Input | surround L/R" to the Black jack and "Centre/subwoofer" to the Orange jack on the sound card.
    Do a speaker test via the Creative Surround Mixer application.
    Jason

  • Need help with pictures on an external HDD and windows labtop to Ipad3

    Hallo everybody!
    This week (I finally) bought an Ipad 3 and an Apple TV!
    For the time being I still have a windows labtop and an external HDD full with photo's.
    The ICloud software for windows has been installed because I would like to stream the pictures from this external HDD to my Ipad and then ofcourse on my flatscreen TV (via Apple TV). And ofcourse back, when I have taken a photo or a movie on the Ipad 3.
    I would appreciate some help with the following questions:
    do I have add all pictures from the HDD into a new map on the windows labtop. So that via Icloud the contain could become 'in the cloud'.
    or do I have to add all the pictures from the HDD into the Itunes map on the windows labtop.
    I have connected the Ipad to the windows labtop and via Itunes I have synchroniced a lot of pictures to the Ipad. I asume these are copies? And is it possible to remove them from the Ipad, because it will take a lot of memory (currently already 35 GB from the 64 GB).
    Well I hope somebody could help me.
    Many thanks in advance!
    Ronald from the Netherland

    I just found out that ICloud isen't really a storage place for photo's. Just a passing throw station to your other devices.

  • Invoicing: monitor Credit Memo and Invoicing posts

    Hello,
    Looking for an Invoice Management System expert. I would like to know the following two things.
    1. On posting an 'incomming invoice' (with reference to a PO) in SRM this Invoice will be replicated to the R/3 back-end system. The back-end will and should use this invoice to follow-up the financial administrative process, how do they go about on this. The purchase order and Invoice will be posted to f.e. G/L 'Sources, with tax 19%'. What transaction do financial administrators use to book/post bank/liquid asset changes against these invoices?
    2. Up on creating a credit memo, for example for 1 of the 2 line items that wern't delivered but where initially invoiced, do we need to create a Credit Memo in SRM with negative amounts or does the Credit Memo with positive amounts suffice (it will always be used as credit, positive doesn't mean it's debit)?
    Kind regards,
    Tim

    Hello,
    Subsequent Debit and Credits
    After an Invoice is successfully posted and the transaction is completed, Vendor approaches with additional amount invoice or correction in Invoice.You would like to post this additional invoice with reference to the original PO and item. Subsequent Debit / Credit functionality allows you to capture this difference without canceling original invoice.
    Please check this link
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/a8/b99890452b11d189430000e829fbbd/frameset.htm
    Regards,
    Shailesh

  • MIRO credit memo and invoice

    Need some help with the following:
    By mistake posted credit memo in MIRO instead of posting invoice in MIRO. Then reversed the credit memo by going in MR8M. The reversal of credit memo posted an invoice in MIRO.  Now we want to post the MIRO invoice but it doesn't post because the PO does not bring up any quantities.
    If we ignore this and go straight to pay the vendor, the outgoing amount is zero (because there is a debit and credit of the same amount posted to the vendor account due to invoice and credit memo existing of the same amount). This is because of reversing the credit memo whcih generated the invoice and now the amount is zero.
    How do we overcome this. And what is the best practice to reverse a credit memo if entered by mistake instead of choosing invoice in MIRO.

    Hi,
    Check First Purchase order history,
    Goods Received Document,
    And Credit memo if exist first reverse MR8M then need to rise invoice.
    If credit memo allredy reversed if unable to book invoice Book Direct FI invoice through F-43 respective vedor
    Regards

  • F110 - Clearing of Credit Memo and Invoice Document in Customer account

    Hi,
    The scenario is, the customer is posted with invoice amount of 3000 and a credit memo of 500. Instead of clearing this manually using f-32 can we use F110 to clear the debit and credit with in a customer account which must create a residual document for the differential (2500)
    please advice,  and the steps to be performed to achieve the scenario.
    Best regards
    Abishay

    Hi All,
    we have activated Business Function " LOG_MMFI_P2P " and Switch "MM_SFWS_CI_01 - Enhanced Functions in EhP4 for Applications in Materials Management" using Tcode SFW1. And followed all instructions documented when activated Business Function " LOG_MMFI_P2P ". The Busines function is activated to order to clear downpayments at the time of invoice posting in MIRO or MIR7. When I post the invoice in MIRO system is posting 2 indepedent document as below.
    1. Invoice posting,
    Dr GR/IR
    Cr Vendor
    2. Downpayment Recovery
    Dr Vendor
    Cr Vendor with SP GL Indicator "C"
    My point is, as per the link http://help.sap.com/erp2005_ehp_04/helpdata/EN/48/b42c22e8603095e10000000a421937/frameset.htm, it says "You can use the Down Payment Clearing function to clear down payments that you have posted with reference to a purchase order without going to the relevant financial accounting transactions, directly in logistics invoice verification."
    But, in my case, the system is not clearing the downpayment but instead is just posting a Credit memo account entry with SP GL indicator (refer to th Downpayment Entry).
    Please advice if SAP is designed to clear the downpayment in LIV or just to post the downpayment recovery entry.
    If advice on any corrections to be applied.
    Best regards
    Abishay Solomon

  • Credit Memo and Invoice (MIRO)

    Hi Experts,
    'We have posted many Invoice (MIRO) Vendor Credit, GR/IR Debit, also we have posted several Credit Memo (Vendor Debit, GR/IR Credit), document type of both the document is RE, how can I segregate them.
    Please explain.
    Regards
    GR

    GR,
    I believe you have to look at both the Header and Item tables.
    In table RBKP there is a field Invoice where X = invoice and no entry indicates a credit.
    To determine if you are dealing with a normal invoice/credit or a subsequent debit/credit you then have to go to table RSEG and there is a Subsequent debit/credit field.
    Invoice    Subs deb/cred
    X                                      = invoice
    X                      X             = subsequent debit
                            X              = credit
    X                      X             = subsequent credit
    Regards,
    Nick

  • FV70 AND FV75 parking customer credit memos and invoices

    Hi,
    I have two questions related to the parked customer invoices and credit memos :
    1 )It is any way to enhance those two transactions ( FV70 and FV75 ) with a new business transactions , customer debit memo ?
    2 )When I try to use FV70 to park  a customer invoices, I am getting an error message " Document type DR not defined " even though DR is defined as a document type.
    Please let me know
    Regards
    Csaba Deac

    Hi,
    I am getting the same error message with FB70 : "Document type DR not defined"
    Regards
    Csaba Deac

  • Technical difference between credit memo and invoice

    Hi,
    What is difference between transaction invoice and credit memo that are created in transaction FB60 and FB65.( is there any field that can exactly differentiate between these transaction types)
    Regards
    paveee.

    Hi Praveen,
    I think this is not related workflow question but i know the some difference fields in b/w these two.
    Vendor Invoice (FB60)
    Incoming Credit Memos (FB65)
    Incoming Credit Memos:
    As required fields:
    · Transactn
    · Bal.
    · Vendor
    · Document date
    · Doc. type
    · Posting date
    · Reference
    · Amount
    · Currency
    · Text
    · Company code
    Vendor Invoice
    As required fields:
    ·         Transactn
    ·         Bal.
    ·         Vendor
    ·         Invoice date
    ·         Doc. type
    ·         Posting date
    ·         Reference
    ·         Amount
    ·         Currency
    ·         Text
    ·         Baseline date
    ·         Company Code
    Thanks and Regards,
    Prabhakar Dharmala

  • Need help with query that can look data back please help.

    hi guys i have a table like such
    CREATE TABLE "FGL"
        "FGL_GRNT_CODE" VARCHAR2(60),
        "FGL_FUND_CODE" VARCHAR2(60),
        "FGL_ACCT_CODE" VARCHAR2(60),
        "FGL_ORGN_CODE" VARCHAR2(60),
        "FGL_PROG_CODE" VARCHAR2(60),
        "FGL_GRNT_YEAR" VARCHAR2(60),
        "FGL_PERIOD"    VARCHAR2(60),
        "FGL_BUDGET"    VARCHAR2(60)
      )and i have a data like such
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
    fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
    so im trying to write a query that basically does the following.
    im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
    so the expected outcome should be $700
    240055     240055     7240     4730     02     10     14     200
    240055     240055     7600     4730     02     10     14     100
    240055     240055     7600     4730     02     11     1     400keep in mind that im not given a year just a period.
    any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
    finally broke down and put together this post
    Edited by: mlov83 on Sep 14, 2011 8:48 PM

    Frank
    wondering if you can help me modify this sql statement that you provided me with .
    table values have been modified a bit.
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
    Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
    the current period +(current period - greatest year 00)
    hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
    because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
    period 2 amount $ 600
    period 0 amount $ 400 - period 2 amount of $600 = 200
    600+200 = $800
    if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
    i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
    can you please help me out.
    Miguel

Maybe you are looking for