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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.