I have a query with an object in it called "Date Created". I need to generate separate set of dates (days) to be used to compare against Date Created. The "generated" dates would be created based on the values entered by the user via prompt
For example:
User enters start date=1/15/2013 and end date of 1/17/2013
Date Date Created Age of Object
1/15/2013 1/1/2013 14
1/16/2013 1/1/2013 15
1/17/2013 1/10/2013 7
Is there any way to do this?
Thanks!
A couple things spring to mind.
The first is that, unless I'm missing something, in your example there should be 6 rows in your data set.
Date Date Created Age of Object
1/15/2013 1/1/2013 14
1/16/2013 1/1/2013 15
1/17/2013 1/1/2013 16
1/15/2013 1/10/2013 5
1/16/2013 1/10/2013 6
1/17/2013 1/10/2013 7
Unless there's a join not mentioned, it should be creating a Cartesian product.
As for creating the data range, the best way of doing this is to create a time dimension. A table with each row representing a single day. By adding a table like this you could very easily generate the report you need by joining the time dimension on date created. Which database do you have? There are dozens of scripts that will automatically create and populate a table for you.