我在一个postgresql 8.3数据库。我正试图找出下面查询中的错误。我试图设计一个查询来只选择私人地址的source_ips和destination_ips。SQL查询选择公共IP地址
由于某种原因,在下面的查询中抓取的地址之一是地址208.117.252.39,它不是私人地址。
下面的查询中的逻辑是否有问题会使它选择公有IP地址?
select source_ip, destination_ip
from ip_table
where
(
inet '10/8' >> source_ip
or inet '192.168/16' >> source_ip
or source_ip >= inet '172.16/16' and source_ip < inet '172.32/16'
)
and inet '10/8' >> destination_ip
or inet '192.168/16' >> destination_ip
是,如果更改了相同> =以>>和< to >>? –
为了清楚起见,尝试用“inet”172.16/12'>> source_ip“替换”source_ip> = inet'172.16/16'和source_ip
hoxworth