pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuery for duplicates.
3+ messages / 2 participants
[nested] [flat]
* Query for duplicates.
@ 1999-08-05 16:46 Matthew Hagerty <matthew@venux.net>
1999-08-05 20:19 ` Re: [SQL] Query for duplicates. John M. Flinchbaugh <glynis@butterfly.hjsoft.com>
1999-08-05 20:45 ` Re: [SQL] Query for duplicates. Matthew Hagerty <matthew@venux.net>
0 siblings, 2 replies; 3+ messages in thread
From: Matthew Hagerty @ 1999-08-05 16:46 UTC (permalink / raw)
To: pgsql-sql
Greetings,
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;
I know this does not work, but if it did it would have the results I am
looking for.
Thanks,
Matthew
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] Query for duplicates.
1999-08-05 16:46 Query for duplicates. Matthew Hagerty <matthew@venux.net>
@ 1999-08-05 20:19 ` John M. Flinchbaugh <glynis@butterfly.hjsoft.com>
1 sibling, 0 replies; 3+ messages in thread
From: John M. Flinchbaugh @ 1999-08-05 20:19 UTC (permalink / raw)
To: 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@hjsoft.com <- john@cs.millersv.edu |
| glynis@netrax.net http://www.hjsoft.com/~glynis/ |
~~Powered by Linux: Reboots are for hardware upgrades only~~
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] Query for duplicates.
1999-08-05 16:46 Query for duplicates. Matthew Hagerty <matthew@venux.net>
@ 1999-08-05 20:45 ` Matthew Hagerty <matthew@venux.net>
1 sibling, 0 replies; 3+ messages in thread
From: Matthew Hagerty @ 1999-08-05 20:45 UTC (permalink / raw)
To: John M. Flinchbaugh <glynis@butterfly.hjsoft.com>; pgsql-sql
Thanks, that works great!
Matthew
At 04:19 PM 8/5/99 -0400, John M. Flinchbaugh wrote:
>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@hjsoft.com <- john@cs.millersv.edu |
>| glynis@netrax.net http://www.hjsoft.com/~glynis/ |
>~~Powered by Linux: Reboots are for hardware upgrades only~~
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1999-08-05 20:45 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-08-05 16:46 Query for duplicates. Matthew Hagerty <matthew@venux.net>
1999-08-05 20:19 ` John M. Flinchbaugh <glynis@butterfly.hjsoft.com>
1999-08-05 20:45 ` Matthew Hagerty <matthew@venux.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox