Jump to content


Photo

Selecting records added between two different dates


  • Please log in to reply
1 reply to this topic

#1 nezbie

nezbie
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts
  • LocationFINLAND

Posted 06 June 2006 - 04:43 PM

Hi

I'd need an example of a query how to SELECT data between two given dates in mysql, I need it for my search function..

I think I'd need to somehow make sql convert given dates to different format than regular date (LIKE 2006-06-05)..

So basicly something like this my query would be (english good, me Ralph :D):

SELECT id FROM lists WHERE list_date_added BETWEEN 2006-06-01 AND 2006-06-06

That doesn't ofcourse work, it's like I told SQL to SEE if an elephant is more than 3..

Any help with this is appreciated greatly, thank you in advance!
:: Be patient with me, I\'m new to PHP and MySQL :: :)

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 09 June 2006 - 05:49 AM

Should be fine -- just add quotes around your date to make them proper string literals.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users