• aslam.jeewa (9/12/2013)


    Thank you the most amazing, incredible SQL query. I cannot begin to describe how much this query assisted me. I have one request though please.

    I now need to run a query that outputs payments against age bucket.

    eg. MemberID, Full payment, 0days Payment, 30days Payment etc. etc.....

    Can you modify so that the query produces the aged report & we then run perhaps another SQL to show how each payment was "allocated".

    Thanking you kindly.

    You'd probably do better starting your own thread with DDL, consumable sample data and expected results, rather than reviving a 5 year old thread. If you post it in the right forum (SQL 2005, 2008, 20012) you might even get a better solution for your platform based on newer available syntax.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St