Derive date column based on current date and fixed start date

stefan

I have the following two columns:

date (datetime),
month_after_release (int)

These columns are filled monthly as part of an incremental update.

Let's say there was a release on Jan 1, 2015. This means we are currently in the 9th month after release [formula: round off((current date - release date)/30,0)+1 = 9] . So if I am now importing data with a current date (Sep 21, 2015), the two columns should be filled like this:

date = 2015-09-21 00:00:00.000
month_after_release = 9

In October, data which gets imported should then get the following information:

date = 2015-10-21 00:00:00.000
month_after_release = 10

How can I achieve this? One possibility which came to my mind would be to have a separate mapping table, which maps every single date to "month_after_release", but I was wondering if there is a better possibility?

The information when a release was is stored in a separate table, which looks like this:

ReleaseID,
Release_start_date
simon at rcl
select releaseDate, DateDiff(MM, releaseDate, getdate()) MonthsSinceRelease
from table t

That's how you calculate it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Derive date column based on current date and fixed start date

From Dev

Date Validation based on current date

From Dev

Windows batch compare fixed date with current date

From Dev

Derive an End date by Man hours and a start date in Excel-2010

From Dev

how get the last week as start date and end date based on date in current week in scrapy

From Dev

how get the last week start date and end date based on date in current week ruby

From Dev

Start Date and End Date Of current month in MySql?

From Dev

How to delay a timer from running or start it based on current date time

From Dev

MySQL date column auto fill with current date

From Dev

MySQL date column auto fill with current date

From Dev

Substract date column in mysql from current date

From Dev

Update date column with current date where NULL

From Dev

How can I determine the date of a WeekDay column in a result set with a fixed layout given the start date?

From Dev

SQL Sum to column multiple items from start to current date

From Dev

end date selection based on start date in laravel

From Dev

Getting next date based on start date in Oracle

From Dev

Tibco Spotfire, how to insert yesterday column based on current date

From Dev

Angular Filtering based on current date

From Dev

Query for current salary based on date

From Dev

Ordering an array based on current date

From Dev

VBA - Insert Current Date in Column

From Dev

VBA - Insert Current Date in Column

From Dev

Get list with results from start to end date based on frequency column

From Dev

Sorting events based on their start date

From Dev

Count ID based on start date

From Dev

SQL Server: Adjusting queried date range based on current date and adjust column headers as well

From Dev

SQL Server: Adjusting queried date range based on current date and adjust column headers as well

From Dev

Excel - Auto populate a date column based on ID, start date and sequence (reference)

From Dev

PHP: get next date based on fixed base date

Related Related

  1. 1

    Derive date column based on current date and fixed start date

  2. 2

    Date Validation based on current date

  3. 3

    Windows batch compare fixed date with current date

  4. 4

    Derive an End date by Man hours and a start date in Excel-2010

  5. 5

    how get the last week as start date and end date based on date in current week in scrapy

  6. 6

    how get the last week start date and end date based on date in current week ruby

  7. 7

    Start Date and End Date Of current month in MySql?

  8. 8

    How to delay a timer from running or start it based on current date time

  9. 9

    MySQL date column auto fill with current date

  10. 10

    MySQL date column auto fill with current date

  11. 11

    Substract date column in mysql from current date

  12. 12

    Update date column with current date where NULL

  13. 13

    How can I determine the date of a WeekDay column in a result set with a fixed layout given the start date?

  14. 14

    SQL Sum to column multiple items from start to current date

  15. 15

    end date selection based on start date in laravel

  16. 16

    Getting next date based on start date in Oracle

  17. 17

    Tibco Spotfire, how to insert yesterday column based on current date

  18. 18

    Angular Filtering based on current date

  19. 19

    Query for current salary based on date

  20. 20

    Ordering an array based on current date

  21. 21

    VBA - Insert Current Date in Column

  22. 22

    VBA - Insert Current Date in Column

  23. 23

    Get list with results from start to end date based on frequency column

  24. 24

    Sorting events based on their start date

  25. 25

    Count ID based on start date

  26. 26

    SQL Server: Adjusting queried date range based on current date and adjust column headers as well

  27. 27

    SQL Server: Adjusting queried date range based on current date and adjust column headers as well

  28. 28

    Excel - Auto populate a date column based on ID, start date and sequence (reference)

  29. 29

    PHP: get next date based on fixed base date

HotTag

Archive