Skip site navigation (1) Skip section navigation (2)

SQL question....

From: Karl Denninger <karl(at)denninger(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: SQL question....
Date: 2008-05-20 18:14:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
.... assuming the following schema:

create table access (name text, address ip)

I want to construct a SELECT statement which will return ONLY tuples 
containing IP and name pairs IF there is an IP that has two or more 
NAMEs associated with it.

I've not figured out how to do this; I can get a list of all IPs and 
names ordered by IP, which I could then parse with a different program 
(e.g. "Select name, address from access order by address"), but the idea 
of course is to do it with one SELECT statement and return only rows 
that have multiple names listed for a given IP.

Karl Denninger (karl(at)denninger(dot)net)


pgsql-sql by date

Next:From: chester c youngDate: 2008-05-20 19:06:32
Subject: Re: SQL question....
Previous:From: Bryce NesbittDate: 2008-05-19 21:48:34
Subject: Supplying a default on read, if a column does not exist in DB

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group