SELECT b.valid_id,a.code,b.server_url,b.provide,a.ip,a.port,a.country,a.province,a.city,a.county,a.pcc,a.isp,a.finish_time,a.invalid_time FROM http_ip_pool AS a leftJOIN http_product_dynamic_node AS b ON a.CODE = b.CODE ORDERBY invalid_time ASC
2.mysql 查询当前时间与五分钟后的时间差
current_time: 数据库当前时间
expr : 时间数 unit : 时间单位 <SECOND,MINUTE,HOUR,DAY : 秒,分,时,天>
SUBDATE(date,INTERVAL expr unit) : date 向前偏移 expr unit 时间
ADDDATE(date,INTERVAL expr unit) : date 向后偏移 expr unit 时间
SELECT*FROM http_ip_pool WHERE TIMESTAMPDIFF(SECOND,current_time,invalid_time)>60AND TIMESTAMPDIFF(SECOND,current_time,invalid_time)<300;
## 包含节点名称等信息的联表查询
SELECT b.valid_id,a.code,b.server_url,a.ip,a.port,a.country,a.province,a.city,a.county,a.pcc,a.isp,a.finish_time,a.invalid_time FROM http_ip_pool AS a leftJOIN http_product_dynamic_node AS b ON a.CODE = b.CODE WHERE TIMESTAMPDIFF(SECOND,current_time,a.invalid_time)>60AND TIMESTAMPDIFF(SECOND,current_time,a.invalid_time)<300;
查询结束时间在 当前时间后的 1 ~ 5 分钟之间的节点
SELECT*FROM http_ip_pool WHERE invalid_time BETWEEN addDATE(current_time,INTERVAL1MINUTE)AND addDATE(current_time,INTERVAL5MINUTE);
## 包含节点名称等信息的联表查询
SELECT b.valid_id,a.code,b.server_url,a.ip,a.port,a.country,a.province,a.city,a.county,a.pcc,a.isp,a.finish_time,a.invalid_time FROM http_ip_pool AS a leftJOIN http_product_dynamic_node AS b ON a.CODE = b.CODE WHERE a.invalid_time BETWEEN addDATE(current_time,INTERVAL1MINUTE)AND addDATE(current_time,INTERVAL5MINUTE);