July 18, 2005 at 5:30 am
I have a table with one column which has many records which are not distinct. I need to find the distinct values from that column and number of times it’s repeated.
Regards
Binu John
July 18, 2005 at 10:00 am
Binu - I can't test this right now but it should be something like:
select Column, count(Column) as Number
from table group by Column
having count(Column) > 1
**ASCII stupid question, get a stupid ANSI !!!**
July 19, 2005 at 5:37 am
Binu - Reply by Sushila will give you duplicate records only. If you want to see the distinct column value then you can use the following query:
Select distinct Column from Table
if you want to see all the records with its occurrence then the following query should be used.
Select column,Count(*) as number from table group by column
July 19, 2005 at 5:53 am
Yes - my response will get only those values that are duplicate (somehow "reading between the lines" that is what I thought was the requirement)....
and yes - if you remove the "having..." clause from my statement shakti's 2nd statement will do the job!
**ASCII stupid question, get a stupid ANSI !!!**
July 19, 2005 at 9:39 pm
Thanks a ton Shakti and Susheela
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply