Get Transactions in latest month

  • Hi,

    Please help me with a query to get records in the latest month.

    I will be using this query in my reports which will be executed any time.

    I have a table storing the item No.,Quantity,transdate.

    Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    560-00 4 10/11/08

    567-980 3 10/11/07

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    When I execute this report it should return

    Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    Madhav.

  • chatexpert (12/6/2008)


    Hi,

    Please help me with a query to get records in the latest month.

    I will be using this query in my reports which will be executed any time.

    I have a table storing the item No.,Quantity,transdate.

    Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    560-00 4 10/11/08

    567-980 3 10/11/07

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    When I execute this report it should return

    Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    Madhav.

    Please define what you mean by latest month. In the above record set you have data from both October and November of 2008 (even one record from 07).

  • Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    560-00 4 10/11/08

    567-980 3 10/11/07

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    When I execute this report it should return

    Item No. Qty Transdate

    --------------------------------

    560-00 5 11/12/08

    567-980 2 10/11/08

    567-980 3 11/11/08

    456-890 2 10/11/07

    In the above for item 567-980 has transaction in October & November but I require transactions only in the month of November (as it the latest month) and in the case of 456-890 latest transaction was in month of November so I require all transaction of item 456-890 in November.

    If there was a transaction for item in 456-890 then I am not concerned of November, then I require all transactions of 456-890 in December.

    Madhav.

  • For a better, tested answer quicker. please see the link in my signature below.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply