Hope someone can help. I have a sql db table that contains daily records, there is 1 record each day for each storage device. I need to query (pull) only the last day of each month for the last 24 months. How can I query the table to extract only the last day of each month for the last 24 months ?
Table sample data looks something like this:
device_name date_captured capacity capacity_used
bosnv002 2011-03-27 04:00:00 5432 4321
bosnv001 2011-03-27 11:00:00 7542 2123
Assuming that there are many more records for many more devices going back 2 years, how would I query a table like this to get output that conatins ONLY the records for last day of the month?
Sample query output:
bosnv002 2011-02-28 04:00:00 5432 3455
bosnv002 2011-01-31 04:00:00 5432 3890
bosnv002 2010-12-31 04:00:00 5432 4563
bosnv001 2011-02-28 04:00:00 7542 5467
bosnv001 2011-01-31 04:00:00 7542 6654
bosnv001 2010-12-31 04:00:00 7542 5983
Is there a way of producing a query output given that the last day of each of the last 24 months is unknown at the time of query? Thanks for any help or direction you can offer.
LS
Table sample data looks something like this:
device_name date_captured capacity capacity_used
bosnv002 2011-03-27 04:00:00 5432 4321
bosnv001 2011-03-27 11:00:00 7542 2123
Assuming that there are many more records for many more devices going back 2 years, how would I query a table like this to get output that conatins ONLY the records for last day of the month?
Sample query output:
bosnv002 2011-02-28 04:00:00 5432 3455
bosnv002 2011-01-31 04:00:00 5432 3890
bosnv002 2010-12-31 04:00:00 5432 4563
bosnv001 2011-02-28 04:00:00 7542 5467
bosnv001 2011-01-31 04:00:00 7542 6654
bosnv001 2010-12-31 04:00:00 7542 5983
Is there a way of producing a query output given that the last day of each of the last 24 months is unknown at the time of query? Thanks for any help or direction you can offer.
LS