我的方法如下(错误的): 两个字段一个存储的值为startip,另一个为endip 现在如果用户输入某个ip,查看是否属于这个库里的某条记录, 请问sql语句怎么写? 我写了下面的,不过由于是进行的字符串比较,所以结果肯定是不正确的! SQL> select endip from emtb where substr('192.168.0.15',instr('192.168.0.15','.' ,1,3)+1,length('192.168.0.15')) between substr(endip,instr(endip,'.',1,3)+1,leng th(endip)) and substr(startip,instr(startip,'.',1,3)+1,length(startip));
两个字段一个存储的值为startip,另一个为endip
现在如果用户输入某个ip,查看是否属于这个库里的某条记录,
请问sql语句怎么写?
我写了下面的,不过由于是进行的字符串比较,所以结果肯定是不正确的!
SQL> select endip from emtb where substr('192.168.0.15',instr('192.168.0.15','.'
,1,3)+1,length('192.168.0.15')) between substr(endip,instr(endip,'.',1,3)+1,leng
th(endip)) and substr(startip,instr(startip,'.',1,3)+1,length(startip));