Guest Hunter Posted January 19, 2010 Share Posted January 19, 2010 I have a table that has two columns: Time which is DATETIME and is date and minute by minute data. The second column is a dollar value.I want to write a query to grab the last dollar value for each given day. So if my values were:DATE DOLLAR 1/10/2010 4:01pm 13001/10/2010 4:02pm 12001/10/2010 4:03pm -65001/10/2010 4:04pm -50001/10/2010 4:05pm 2500 <---1/11/2011 3:05pm 40001/11/2011 3:06pm 50001/11/2011 3:07pm 10000 <---My query would return:1/10/2010 4:05pm 25001/11/2011 3:07pm 10000I think I need to query the dates first, and then look for those dollar values, but I have a very limited knowledge of SQL to even do that.Thank you for your help! Link to comment Share on other sites More sharing options...
ProblemHelpPlease Posted January 19, 2010 Share Posted January 19, 2010 You need a select that selects all entries from the data field that match the day you are looking for and the sorts them with an ascending or descending 'order by' and a limit 1. You can then run the same query for each date maybe through a loop. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.