Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL help. Counting duplicate rows (Grrrr kill users!)
Janet tried:
>>but do i have an answer? hmmmm..
>>perhaps something like:
>>column col_2 noprint
>>select distinct col_1, col_2, count(*)
>>from table_name
>>group by col_1, col_2
>>/
Well, that didn't give me quite what I wanted as the it still does the distinct on col2 even though it doesn't print it. BUT
You've led me down the right path (and Theresa & John, Ta), by putting this as a subquery in the from, Bob is your proverbial. Thus:
select distinct col1, col2_count
from (select col1, col2, count(*) col2_count
from table1
group by col1, col2)
Try it, it works! I'm feeling good now! : )
Trouble is, now I'll have to start getting rid of all the duplicates : (
Thanks again.
Ian (complete with warm feeling inside).
*----------------------------------------------* * "Think for yourself - Question Authority" * * Dr. Timothy Leary (1920 - 1996) * *----------------------------------------------*Received on Wed Nov 27 1996 - 00:00:00 CST