bigfatwallet Posted November 5, 2005 Share Posted November 5, 2005 Good evening all. I have a table that has a column called enddate and is of datatype date. (The dates will always be in the future.) I would appreciate any help with the following: 1) The next date (in date terms - not table terms) 2) The maximum date Can you please also advise how I get this to output to a browser. Many thanks in advance Link to comment https://forums.phpfreaks.com/topic/2806-find-maximum-date-from-table/ Share on other sites More sharing options...
sasa Posted November 5, 2005 Share Posted November 5, 2005 Good evening all. I have a table that has a column called enddate and is of datatype date. (The dates will always be in the future.) I would appreciate any help with the following: 1) The next date (in date terms - not table terms) 2) The maximum date Can you please also advise how I get this to output to a browser. Many thanks in advance 315128[/snapback] 1st SELECT * FROM table_name ORDER BY enddate DESC LIMIT 1 2nd SELECT * FROM table_name WHERE enddate>now() ORDER BY enddate ASC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/2806-find-maximum-date-from-table/#findComment-9397 Share on other sites More sharing options...
bigfatwallet Posted November 5, 2005 Author Share Posted November 5, 2005 Thank you so much. I can't believe I didnt think of that myself, I was trying min and max and all sorts of sutff! lol Once again thanks. Link to comment https://forums.phpfreaks.com/topic/2806-find-maximum-date-from-table/#findComment-9399 Share on other sites More sharing options...
happs Posted April 14, 2006 Share Posted April 14, 2006 Just to clarify .. I have a table with a date column in the format of YYYY-MM-DD for a database of events. Each event has a date and I want the site I am working on to get the NEXT event according to today's date. Would this code work for this also ? Thanks in advance - Alex [!--quoteo(post=315172:date=Nov 5 2005, 08:49 PM:name=bigfatwallet)--][div class=\'quotetop\']QUOTE(bigfatwallet @ Nov 5 2005, 08:49 PM) 315172[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thank you so much. I can't believe I didnt think of that myself, I was trying min and max and all sorts of sutff! lol Once again thanks. Link to comment https://forums.phpfreaks.com/topic/2806-find-maximum-date-from-table/#findComment-26968 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.