• Sean Lange (10/11/2013)


    smharabbani40 (10/11/2013)


    Hi I need a Query from the month 112013 to 122013 sir......

    i have used the below Query which is not satisfieing.

    SELECT Emp,

    SUM (AMOUNT),

    Monthyear

    FROM table WHERE MonthYear between 112013 and 122013

    GROUP BY Emp

    Sorry to say ,if it very easy thing i wont put in here.

    anyhow thanks for your replay

    That query won't run because you did not also group by Monthyear.

    It seems like Monthyear is an int datatype? If at all possible I would highly recommend changing to a date or datetime datatype instead. It will provide instant validation that the data entered is valid and it will let you do datemath without being forced to cast/convert it first.

    Plus 1 billion to that.

    --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)