View Full Version : Count question

01-18-2010, 07:13 PM
Hi there.

I am new to these forums and would be very grateful for any assistance with the following issue i have.

I have a table, in one column lists people's first names. I need to create a bit of php code which will count how many people have the same first name.

The trouble is, because any first name can be present in the database column i dont know how to count if there are any repeats.

Can want i am wanting to achieve be done?

thanks for any help.

01-18-2010, 07:20 PM
SELECT `name_column_name`, COUNT(`name_column_name`) as `total` FROM `user_table_name` GROUP BY `name_column_name`Use that SQL, replacing the values with yours (ie name_column_name and user_table_name)

01-19-2010, 11:25 AM
worked a charm. thank you!