Jump to content

Getting minimal date in my table mysql


sugan

Recommended Posts

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 rone
Now 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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...