要求查询结果如下图所示:
-- mysql 表结构 脚本
CREATE TABLE `clt_forex` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`symbol` varchar(255) DEFAULT NULL,
`bid` varchar(255) DEFAULT NULL,
`ask` varchar(255) DEFAULT NULL,
`price` varchar(255) DEFAULT NULL,
`timestamp` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6861 DEFAULT CHARSET=utf8;
-- -----mysql原始数据-----------------
INSERT INTO `clt_forex` VALUES ('66', 'GBPUSD', '1.40533', '1.40537', '1.40535', '1524212525');
INSERT INTO `clt_forex` VALUES ('67', 'EURUSD', '1.23305', '1.23306', '1.23306', '1524212525');
INSERT INTO `clt_forex` VALUES ('68', 'USDJPY', '107.55', '107.55', '107.55', '1524212525');
INSERT INTO `clt_forex` VALUES ('69', 'USDCAD', '1.26731', '1.26734', '1.26733', '1524212525');
INSERT INTO `clt_forex` VALUES ('70', 'AUDUSD', '0.77069', '0.77069', '0.77069', '1524212525');
INSERT INTO `clt_forex` VALUES ('71', 'GBPUSD', '1.40536', '1.40539', '1.40537', '1524212526');
INSERT INTO `clt_forex` VALUES ('72', 'EURUSD', '1.23308', '1.23309', '1.23308', '1524212526');
INSERT INTO `clt_forex` VALUES ('73', 'USDJPY', '107.549', '107.551', '107.55', '1524212526');
INSERT INTO `clt_forex` VALUES ('74', 'USDCAD', '1.26731', '1.26734', '1.26733', '1524212526');
INSERT INTO `clt_forex` VALUES ('75', 'AUDUSD', '0.7707', '0.7707', '0.7707', '1524212526');
INSERT INTO `clt_forex` VALUES ('76', 'GBPUSD', '1.40536', '1.40539', '1.40537', '1524212527');
INSERT INTO `clt_forex` VALUES ('77', 'EURUSD', '1.23308', '1.23309', '1.23308', '1524212527');
INSERT INTO `clt_forex` VALUES ('78', 'USDJPY', '107.55', '107.55', '107.55', '1524212527');
INSERT INTO `clt_forex` VALUES ('79', 'USDCAD', '1.26731', '1.26734', '1.26733', '1524212527');
INSERT INTO `clt_forex` VALUES ('80', 'AUDUSD', '0.7707', '0.7707', '0.7707', '1524212527');
INSERT INTO `clt_forex` VALUES ('81', 'GBPUSD', '1.40536', '1.40539', '1.40537', '1524212528');
INSERT INTO `clt_forex` VALUES ('82', 'EURUSD', '1.23308', '1.23309', '1.23308', '1524212528');
INSERT INTO `clt_forex` VALUES ('83', 'USDJPY', '107.548', '107.549', '107.5485', '1524212528');
INSERT INTO `clt_forex` VALUES ('84', 'USDCAD', '1.26731', '1.26734', '1.26733', '1524212528');
INSERT INTO `clt_forex` VALUES ('85', 'AUDUSD', '0.7707', '0.7707', '0.7707', '1524212528');
INSERT INTO `clt_forex` VALUES ('86', 'GBPUSD', '1.40536', '1.40539', '1.40537', '1524212529');
INSERT INTO `clt_forex` VALUES ('87', 'EURUSD', '1.23309', '1.2331', '1.2331', '1524212529');
INSERT INTO `clt_forex` VALUES ('88', 'USDJPY', '107.549', '107.549', '107.549', '1524212529');
INSERT INTO `clt_forex` VALUES ('89', 'USDCAD', '1.26728', '1.26732', '1.2673', '1524212529');
INSERT INTO `clt_forex` VALUES ('90', 'AUDUSD', '0.7707', '0.7707', '0.7707', '1524212529');
INSERT INTO `clt_forex` VALUES ('91', 'GBPUSD', '1.40536', '1.40539', '1.40537', '1524212530');
INSERT INTO `clt_forex` VALUES ('92', 'EURUSD', '1.23309', '1.2331', '1.2331', '1524212530');
INSERT INTO `clt_forex` VALUES ('93', 'USDJPY', '107.548', '107.549', '107.5485', '1524212530');
INSERT INTO `clt_forex` VALUES ('94', 'USDCAD', '1.26728', '1.26732', '1.2673', '1524212530');
INSERT INTO `clt_forex` VALUES ('95', 'AUDUSD', '0.7707', '0.7707', '0.7707', '1524212530');
INSERT INTO `clt_forex` VALUES ('96', 'GBPUSD', '1.40539', '1.40542', '1.40541', '1524212531');
INSERT INTO `clt_forex` VALUES ('97', 'EURUSD', '1.23309', '1.23311', '1.2331', '1524212531');
INSERT INTO `clt_forex` VALUES ('98', 'USDJPY', '107.548', '107.549', '107.5485', '1524212531');
INSERT INTO `clt_forex` VALUES ('99', 'USDCAD', '1.2673', '1.26733', '1.26731', '1524212531');
INSERT INTO `clt_forex` VALUES ('100', 'AUDUSD', '0.77071', '0.77071', '0.77071', '1524212531');
INSERT INTO `clt_forex` VALUES ('101', 'GBPUSD', '1.4054', '1.40542', '1.40541', '1524212532');
INSERT INTO `clt_forex` VALUES ('102', 'EURUSD', '1.23309', '1.2331', '1.2331', '1524212532');
INSERT INTO `clt_forex` VALUES ('103', 'USDJPY', '107.549', '107.549', '107.549', '1524212532');
INSERT INTO `clt_forex` VALUES ('104', 'USDCAD', '1.2673', '1.26733', '1.26731', '1524212532');
INSERT INTO `clt_forex` VALUES ('105', 'AUDUSD', '0.77071', '0.77071', '0.77071', '1524212532');
INSERT INTO `clt_forex` VALUES ('106', 'GBPUSD', '1.40539', '1.40542', '1.40541', '1524212533');
INSERT INTO `clt_forex` VALUES ('107', 'EURUSD', '1.23309', '1.2331', '1.2331', '1524212533');
INSERT INTO `clt_forex` VALUES ('108', 'USDJPY', '107.549', '107.549', '107.549', '1524212533');
INSERT INTO `clt_forex` VALUES ('109', 'USDCAD', '1.2673', '1.26733', '1.26731', '1524212533');
INSERT INTO `clt_forex` VALUES ('110', 'AUDUSD', '0.77071', '0.77071', '0.77071', '1524212533');
3 个解决方案
#1
求 MYSQL 达人.
#2
顶起来,求帮助。
#3
#1
求 MYSQL 达人.
#2
顶起来,求帮助。