问题如果要查询stime最大和时间最小两条数据中,value字段的差,测试表结构附上,求大牛们指点
现有A表,建表:
CREATE TABLE a
(id
int(11) DEFAULT NULL,value
varchar(10) DEFAULT NULL,stime
datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
添加数据:
INSERT INTO a
VALUES ('1', '2', '2018-05-28 14:39:06');
INSERT INTO a
VALUES ('2', '8', '2018-05-28 17:39:32');
INSERT INTO a
VALUES ('3', '18', '2018-05-28 20:40:12');
INSERT INTO a
VALUES ('4', '25', '2018-05-29 14:40:31');
select