Re: [SQL] Query for duplicates.

From: "John M(dot) Flinchbaugh" <glynis(at)butterfly(dot)hjsoft(dot)com>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Query for duplicates.
Date: 1999-08-05 20:19:44
Message-ID: Pine.LNX.4.10.9908051618140.13066-100000@butterfly.hjsoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 5 Aug 1999, Matthew Hagerty wrote:
> I found myself in an unusual situation today. I need a query to display
> only customers with addresses that appear more than once. Usually I am
> having to get unique addresses, etc. at which I have become very good, but
> this one is giving me a run for.
> What I need is something like this:
> create table customer (
> custdate date,
> name varchar(30),
> address varchar(30),
> city varchar(20),
> state varchar(2),
> zip varchar(10));
> select address,city,state,zip from customer
> where custdate<='05-30-1999'
> group by address having count(address)>1;

select address,city,state,zip from customer
where custdate<='05-30-1999'
group by address,city,state,zip
having count(*)>1;

____________________}John Flinchbaugh{______________________
| -> glynis(at)hjsoft(dot)com <- john(at)cs(dot)millersv(dot)edu |
| glynis(at)netrax(dot)net http://www.hjsoft.com/~glynis/ |
~~Powered by Linux: Reboots are for hardware upgrades only~~

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Matthew Hagerty 1999-08-05 20:45:19 Re: [SQL] Query for duplicates.
Previous Message Ross J. Reedstrom 1999-08-05 17:57:47 Re: [SQL] primary key view failure