6
Reply

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

Amit Soni

Feb 26, 2007
5.5k
0

    select name,COUNT(Name) from tablename group by Name

    Sanjeev Kumar
    July 19, 2016
    0

    Select [Name], Count([Name]) times from Table group by[Name]

    Rahul Prajapat
    May 30, 2015
    0

    Select [Name], Count([Name]) Occ from Table group by[Name]

    Select [Name],Count([Name]) as Times from TableName group by [Name]

    Dinesh Rathi
    March 07, 2007
    0

    SELECT name,COUNT(*)

    FROM emp  --emp is the name of the table that contain column name

    GROUP BY name

    HAVING COUNT(*)>=1

    March 01, 2007
    0

    This seems to work... SELECT field_name,count(*) FROM table_name group BY field_name

    Johnny
    February 26, 2007
    0