用一个简单实例,对遇到的问题复盘一下。
1.新建测试表 test_order
create table test_order(
id int(11) not null auto_increment primary key,
name varchar(10) not null,
create_time datetime not null,
state int(1) default '1'
)
2.插入测试数据
-- ----------------------------
-- Records of test_order
-- ----------------------------
INSERT INTO `test_order` VALUES ('1', '张三', '2016-11-29 08:10:10', '1');
INSERT INTO `test_order` VALUES ('2', '李四', '2016-11-30 12:10:10', '1');
INSERT INTO `test_order` VALUES ('3', '赵一', '2016-11-30 14:10:10', '1');
INSERT INTO `test_order` VALUES ('4', '钱二', '2016-11-29 14:00:00', '1');
INSERT INTO `test_order` VALUES ('5', '周七', '2016-11-29 14:00:00', '1');
INSERT INTO `test_order` VALUES ('6', '郑八', '2016-11-29 14:00:00', '1');
INSERT INTO `test_order` VALUES ('7', '王五',