- 论坛徽章:
- 8
|
- root@localhost:test 10:23:54>select * from t_datetime;
- +---+---------------------+
- | a | b |
- +---+---------------------+
- | 1 | 2010-07-07 10:20:56 |
- | 2 | 2010-07-07 10:21:02 |
- | 5 | 2010-07-07 10:21:48 |
- | 4 | 2010-07-07 10:21:02 |
- +---+---------------------+
- 4 rows in set (0.00 sec)
- root@localhost:test 10:24:00>select * from t_datetime where b between '2010-07-07 10:21:02' and '2010-07-07 10:21:48';
- +---+---------------------+
- | a | b |
- +---+---------------------+
- | 2 | 2010-07-07 10:21:02 |
- | 5 | 2010-07-07 10:21:48 |
- | 4 | 2010-07-07 10:21:02 |
- +---+---------------------+
- 3 rows in set (0.00 sec)
- root@localhost:test 10:24:03>select * from t_datetime where b >='2010-07-07 10:21:02' and b<='2010-07-07 10:21:48';
- +---+---------------------+
- | a | b |
- +---+---------------------+
- | 2 | 2010-07-07 10:21:02 |
- | 5 | 2010-07-07 10:21:48 |
- | 4 | 2010-07-07 10:21:02 |
- +---+---------------------+
- 3 rows in set (0.00 sec)
- root@localhost:test 10:24:14>show create table t_datetime\G;
- *************************** 1. row ***************************
- Table: t_datetime
- Create Table: CREATE TABLE `t_datetime` (
- `a` int(11) NOT NULL auto_increment,
- `b` datetime default NULL,
- PRIMARY KEY (`a`)
- ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8
- 1 row in set (0.00 sec)
复制代码 |
|