• Greg Snidow (2/27/2015)


    This one would fail (or show 2 rows for one customer) if 2 rows had the same date

    If the system is designed so there are not 2 rows with the same date, but indeed there are 2 rows with the same date, then a duplicate row in the results might be a desired effect. At least it would be for me. Just my two cents though.

    If it is desired you can use RANK instead of ROW_NUMBER for the first query.