Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to find tuples with same attr. value
hjelt_at_cc.helsinki.fi wrote:
>>
>> If i hava a table like:
>>
>> P ,T
>> -----
>> 1 1
>> 2 2
>> 3 2
>> 4 3
>> 5 4
>> 6 4
>> 7 4
>> 8 5
>> etc. (P is unique, T is not)
>>
>> how do i find those tuples where T-value appears 1, 2, 3 and 4 times?
>> Thank you
>> andy.
Try
SELECT P,T
FROM table
WHERE T IN (SELECT T
FROM table GROUP BY T HAVING COUNT(*) > n)
(n being the number of repeating values you wish to select for)
Jesse Baldwin
Talus Inc.
--Received on Tue Jul 01 1997 - 00:00:00 CDT
![]() |
![]() |