zuerrong wrote in post #965316:

> +----------+----------+
> | startNum | endNum   |
> +----------+----------+
> | 16777216 | 16777471 |
> | 16843008 | 16843263 |
> | 16909056 | 16909311 |
> | 17367040 | 17498111 |
> | 17498112 | 17563647 |
> | 17563648 | 17825791 |
> | 17825792 | 18153471 |
> | 18153472 | 18219007 |
> | 18219008 | 18350079 |
> | 18350080 | 18874367 |
> +----------+----------+
>

>
> select * from ip_data where startNum <= #{number} and endNum >=
> #{number}

try with

select * from ip_data where startNum = (select max(startnum) from 
ip_data where startnum <= #{number})

-- 
Posted via http://www.ruby-forum.com/.