Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Select statement question
This will probably horrify people that really know what they are
doing, but you may want to try using this as a starting point -
select Id, Site, Equipment, count(*)
from table1
group by Id, Site, Equipment;
the count(*) will tell you about dups if you care. this statement would just return dup rows:
select Id, Site, Equipment, count(*)
from table1
group by Id, Site, Equipment;
having count(*) > 1;
HTH,
Jeff
On 18 Sep 2001 02:48:49 -0700, tony1979_at_hotmail.com (Tony) wrote:
>Hi all, I'm relatively new to SQL, and was wondering if anybody could
>help me with the following:
>
>In a select statement, if Oracle has more than 1 row that is a
>duplicate, I only want to display it once ( I'm not using primary
>keys, because nothing is neccessarily unique ).
>
>For example, a table which holds the following data:
>
>SELECT Id, Site, Equipment FROM table1 order by Id asc;
>
>ID SITE EQUIPMENT
>01 A1 switch
>01 A1 switch
>02 B1 switch
>
>Should only return row 1 and 3 ( or 2 and 3 ).
>
>Is this possible?
>
>Thanks in advance,
>
>Tony Lee, UK.
Received on Tue Oct 02 2001 - 09:22:34 CDT
![]() |
![]() |