I am having difficulty creating a Oracle query to report the historical status of orders on certain days (the first of each month over a series of months). I have searched and searched and have found no one asking a similar question. It seems like a straighforward problem so hopefully someone can help! Here is my example:
ORDERS table:
ORDER_NUMBER STATUS DATE
50001000 Created 01-15-2010
50001000 Released 02-20-2010
50001000 Completed 02-25-2010
50001000 Closed 03-10-2010
50001035 Created 01-20-2010
50001035 Released 01-25-2010
50001035 Completed 04-05-2010
50001035 Closed 05-30-2010
So the output I am needing is the status of each order at the beginning of each month. Something like this:
DATE ORDER_NUMBER STATUS
12-01-2009
01-01-2010
02-01-2010 50001000 Created
02-01-2010 50001035 Released
03-01-2010 50001000 Completed
03-01-2010 50001035 Released
04-01-2010 50001000 Closed
04-01-2010 50001035 Released
05-01-2010 50001000 Closed
05-01-2010 50001035 Completed
06-01-2010 50001000 Closed
06-01-2010 50001035 Closed
07-01-2010 50001000 Closed
07-01-2010 50001035 Closed
..etc
Are there some native keywords that can make this work without lots of joins and subqueries?
Thanks,
Garrett