sql to find one year in datetime MySQL column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How can I find all the records for a single year from a db that has a datetime
column (in MySQL)?

This seems to work:

SELECT * from mytable
WHERE tstamp < '2003-01-01 00:00:00'
AND tstamp > '2002-01-01 00:00:00'

But this doesn't:
SELECT * from mytable
WHERE tstamp LIKE '2002%'

Is there a simpler way than the first one?

kind regards,

bill hollett


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux