我有一张访问表
列
member_id
visit_id
visit_logout_datetime(values like this... '
现在我需要将visit_logout_datetime与今天的日期时间属性进行比较......
这是两个条件
1)我需要compare the today date with date
来自此字段visit_logout_datetime
//这里我想做点什么......
2)我需要比较present time with the time in this field
visit_logout_datetime
我想单独比较..
我怎么能这样做..
任何人都会帮忙解决这个问题....
答案 0 :(得分:8)
mysql> select cast('2011-10-24 15:20:10' as date);
+-------------------------------------+
| cast('2011-10-24 15:20:10' as date) |
+-------------------------------------+
| 2011-10-24 |
+-------------------------------------+
1 row in set (0.00 sec)
mysql> select cast('2011-10-24 15:20:10' as time);
+-------------------------------------+
| cast('2011-10-24 15:20:10' as time) |
+-------------------------------------+
| 15:20:10 |
+-------------------------------------+
1 row in set (0.00 sec)
答案 1 :(得分:2)