Re: Need help with Inet type

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help with Inet type
Date: 2013-09-11 04:58:37
Message-ID: 20130911045836.GA62631@reindeer.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

## Eric Lamer (eric(dot)lamer(at)intact(dot)net):

> I can do something like:
>
> Select * From logs Where src_ip IN (Select ip from ip_table where zone
> = 'ZONE_a');
>
> Of course that does not work since it does not work with Inet type and
> I cannot use << because I have more than 1 row return from the second
> select.

How about:
SELECT DISTINCT logs.* FROM logs
JOIN ip_table ON logs.srcip << ip_table.ip
WHERE zone = 'ZONE_a';

Regards,
Christoph

--
Spare Space

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2013-09-11 05:50:31 Re: pg_largeobjects
Previous Message James Sewell 2013-09-11 04:49:07 pg_largeobjects