sugan Posted September 7, 2008 Share Posted September 7, 2008 Hi,I want to retrieve minimal date from the data i have entered in my database. Say that i have 2008-12-12 Anu2008-1-12 rone2007-12-12 barr2008-2-12 roneNow i want to know which is the minimal date here, so it should give me 2007-12-12.How to write a query to it!Regards,Suganya Link to comment Share on other sites More sharing options...
jeffman Posted September 7, 2008 Share Posted September 7, 2008 I'm guessing the entire string ("2008-12-12 Anu") is stored in a single field? That doesn't seem like a good idea, but okay. Are you using PHP? Load the string into a variable like $date. Then do something like this:$pattern = '/\d+-\d+-\d+/';preg_match($pattern, $date, $min);Your minimum date should be in $min[0]. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.