我想要ip
不在 DHCP 范围内的记录。该ip
表有上万条记录,范围约千。
CREATE TABLE ip (ip int);
CREATE TABLE dhcprange (start int,end int);
INSERT INTO found_ips VALUES
(INET_ATON('10.0.0.10')),
(INET_ATON('10.0.0.11')),
(INET_ATON('10.0.0.12')),
(INET_ATON('10.0.0.51')),
(INET_ATON('10.0.0.52')
);
INSERT INTO dhcpranges VALUES
(INET_ATON('10.0.0.50'),INET_ATON('10.0.0.60'),
(INET_ATON('10.0.0.70'),INET_ATON('10.0.0.100')
);
(不幸的是,这在 sqlfiddle 上不起作用(不支持inet_aton?))
这不起作用:
SELECT ip FROM ip WHERE ip NOT BETWEEN(SELECT start,end FROM dhcprange)
想法?