We have a table with one field name {amit,amit,karan,karan,sumit},write a query to show the name and number of its occurrence.
Amit Soni
select name,COUNT(Name) from tablename group by Name
Select [Name], Count([Name]) times from Table group by[Name]
Select [Name], Count([Name]) Occ from Table group by[Name]
Select [Name],Count([Name]) as Times from TableName group by [Name]
SELECT name,COUNT(*)
FROM emp --emp is the name of the table that contain column name
GROUP BY name
HAVING COUNT(*)>=1
This seems to work... SELECT field_name,count(*) FROM table_name group BY field_name