Data in date column to decrement with one

  • the resolution didnt solve it.

    it decrement the first row successfully. when moving to second row instead of decrementing it to one it decrements it to two , then to third row it decrements by three. e.g.

    actual data to changed data

    2013-06-31 to 2013-06-30

    2013-06-29 to 2013-06-27

    2013-06-25 to 2013-06-21

    where as the requirement is to decrement each one by one only.

    like

    actual data to changed data

    2013-06-31 to 2013-06-30

    2013-06-29 to 2013-06-28

    2013-06-25 to 2013-06-24

    i hope you understand..

  • asifejaz (7/12/2013)


    the resolution didnt solve it.

    it decrement the first row successfully. when moving to second row instead of decrementing it to one it decrements it to two , then to third row it decrements by three. e.g.

    actual data to changed data

    2013-06-31 to 2013-06-30

    2013-06-29 to 2013-06-27

    2013-06-25 to 2013-06-21

    where as the requirement is to decrement each one by one only.

    like

    actual data to changed data

    2013-06-31 to 2013-06-30

    2013-06-29 to 2013-06-28

    2013-06-25 to 2013-06-24

    i hope you understand..

    Isn't this exactly the same as the solution posted by Andrew G, second post on this thread, subtract a day from each date?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 2 posts - 16 through 16 (of 16 total)

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