>Hello List,
>
>Is it true that the date_sub function(s) will only work on datetime column
>types?
>
>SELECT count(id) as id FROM messages WHERE client_id = '2' AND datetime_col
> > date_sub(NOW(),interval 1 day)
>
>To get the above query to work, I had to change my datetime_col column from
>timestamp to datetime, and that breaks A LOT of formatting work I had done
>previously when I thought I was only going to be able to keep with a
>timestamp column type.
>
>Could someone suggest a replacement query for the one above, where I would
>not have to change my datetime column from timestamp to datetime?
Strange indeed.. here's a workaround
SELECT count(id) as id FROM messages WHERE client_id = '2' AND
date_sub(datetime_col,interval 0 day) > date_sub(NOW(),interval 1 day)
Ugly, but in testing (with a timestamp field) it seemed to work.
Regards,
Martin
--
<mailto:mac.com@;nemo>
<http://www.mechintosh.com/>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php