Mysql difference problem

question if you want to query the difference of the value field between the maximum and minimum stime data, and the structure of the test table is attached, ask the bulls to point out
existing A table, build the table:
CREATE TABLE a (
id int (11) DEFAULT NULL,
value varchar (10) DEFAULT NULL,
stime datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

add data:
INSERT INTO a VALUES ("1x, "2mm," 2018-05-28 14lv 39lv 06");
INSERT INTO a VALUES ("2th," 8th, "2018-05-2817lv 39lv 32");
INSERT INTO a VALUES (" 31st, "18th," 2018-05-2820Rd 40L 12");
INSERT INTO <

Mar.14,2021

select

(select value from a where stime = (select max(stime) from a))
- 
(select value from a where stime = (select min(stime) from a));
Menu