• egerencher (9/19/2012)


    "Firstly, I'd like to question why trans# 3 and 6 appear in your expected results. The total charges for period 02-03 Jan is $510 for 123456789 and for 02-03 Apr is $700 for 987654321.?" I thought it would make it easier to include the transaction than to exclude it. But as I am finding out, nothing is easy with my problem. So your point is well taken, and these transactions are not something I need in the results.

    Happy to hear my analysis was correct.

    egerencher (9/19/2012)


    You are dead on with the "real-world quirk". A customer may have more than one card, and I want to create an alert when a customer charges over a certain amount of money within a certain amount of time, whether they put all of the charges on one card or spread them across multiple cards. BRILLIANT

    How about this for a quirk? Why wouldn't you want to assign a different monetary amount to each customer? That would increase the complexity slightly, but not too much to handle.


    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