John Mistler <[EMAIL PROTECTED]> wrote:
> Given a column DATETIMEcolumn (YYYY-MM-DD HH:MM:SS), is there a SELECT
> statement that will:
> 
> select all entries whose (TIME) of DATETIMEcolumn is BETWEEN 'HH:MM:SS' AND
> 'HH:MM:SS', but whose (DATE) is anything?
> 

SELECT .. FROM t1 WHERE DATE_FORMAT(datetime_column, '%T') BETWEEN 'HH:MM:SS' AND 
'HH:MM:SS';

or from version 4.1.1 you can use TIME() function for this purpose.

Description of DATE_FROMAT() and TIME function you can see at:
        http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to