Jump to content


Photo

Select after date


  • Please log in to reply
3 replies to this topic

#1 ego0

ego0
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 15 August 2006 - 02:18 PM

Is there a way of selecting all rows in a table after a certain date.

The date format is 2006-07-22 11:41:17 and I want to select all rows since that date.

So all rows since 2006-07-21 11:41:17

Thanks

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 15 August 2006 - 02:37 PM

if your data type is DATETIME (which it appears to be), you can simply use the greater than operator:
SELECT * FROM table WHERE dateCol > '2006-07-22 11:41:17';

You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 fenway

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

Posted 15 August 2006 - 04:17 PM

I think MySQL is rather lenient, and will "choose" the correct type, even if it was DATE column.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 ego0

ego0
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 15 August 2006 - 08:44 PM

Thanks so much :), You wouldn't beleive how helpful this is!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users