Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: little sql syntax question

Re: little sql syntax question

From: Jim Chapman <Jim.Chapman_at_elsegundoca.ncr.com>
Date: 2000/04/17
Message-ID: <38fbbc35$1@rpc1284.daytonoh.ncr.com>#1/1

How about this:

select b, c, count(*) from A

   group by b, c
   having count(*) > 1

This will return only the values (b,c) that are duplicated at least once.

Doug Cowles <dcowles_at_i84.net> wrote in message news:38f8e98b.68017791_at_news.remarq.com...
> If I have a table with 3 columns(a,b,c), and I want to check the
> distinct values of 2 of out of the three, (to see if the remaining
> values are duplicated, assuming one of them is a primary key, although
> perhaps an ill-defined one in theory), I can do a couple of things.
> I could temporarily put a unique index on the remaining columns to see
> if it succeeds.
> Or, I could do a select count(distinct(b||c)) from table A; (to
> compare it with the count of the table).
> This is my question.. why the ||? It would seem I can't do a select
> distinct (b,c) from A. Am I really reduced to a string comparison? Or
> is there another way? Hope this isn't to obfuscated...
>
> Thanks,
> Dc.
Received on Mon Apr 17 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US