Linda_swe Posted October 28, 2009 Share Posted October 28, 2009 Hi I am trying to find a solution on how to fetch all unique dates from a timestamp (YY-MM-DD-HH-MM-SS). Since HH-MM-SS is included i get a lot of rows from the same date. I would like to do this so i can calculate the sum between the dates .Currently i am using between curdate() and interval 1 day but my plan is to use it in a for loop between the first entry date and the second one (even if they are separated by three days for instance) Of course i could write code to loop through the array and try to sort out unique dates from there but i would prefer to fetch them directly with a SQL query or alter the table and column so the timestamp only show 8 digits..but haven't had any luck. My second guess is doing a select statement and save it as and then somehow use DATE(timestamp) on all rows. Any ideas? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/179426-solved-not-able-to-alter-column-with-timestamp-to-only-yyyy-mm-dd/ Share on other sites More sharing options...
Linda_swe Posted October 29, 2009 Author Share Posted October 29, 2009 typecast as Date and Select distinct. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/179426-solved-not-able-to-alter-column-with-timestamp-to-only-yyyy-mm-dd/#findComment-947237 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.