Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> show create table geoip\G *************************** 1. row ***************************
- Table: geoip
- Create Table: CREATE TABLE `geoip` (
- `ipfrom` varchar(15) default NULL,
- `ipto` varchar(15) default NULL,
- `ipf` int(10) unsigned default NULL,
- `ipt` int(10) unsigned default NULL,
- `ccode` char(3) default NULL,
- KEY `ipf` (`ipf`,`ipt`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1
- 1 row in set (0.00 sec)
- mysql> select * from geoip where 1479868930 >= ipf and 1479868930 <= ipt; +-----------+---------------+------------+------------+-------+
- | ipfrom | ipto | ipf | ipt | ccode |
- +-----------+---------------+------------+------------+-------+
- | 88.32.0.0 | 88.63.255.255 | 1478492160 | 1480589311 | IT |
- +-----------+---------------+------------+------------+-------+
- 1 row in set (0.39 sec)
- mysql> select G.* from geoip G JOIN geoip X ON G.ipf=X.ipf where 1479868930 >= G.ipf and 1479868930 <= X.ipt;
- +-----------+---------------+------------+------------+-------+
- | ipfrom | ipto | ipf | ipt | ccode |
- +-----------+---------------+------------+------------+-------+
- | 88.32.0.0 | 88.63.255.255 | 1478492160 | 1480589311 | IT |
- +-----------+---------------+------------+------------+-------+
- 1 row in set (0.08 sec)
- mysql> select count(*) from geoip;
- +----------+
- | count(*) |
- +----------+
- | 140246 |
- +----------+
- 1 row in set (0.00 sec)
- mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement