Jump to content
Sign in to follow this  
sugan

Getting minimal date in my table mysql

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

Share this post


Link to post
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].

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...