I'm working on a php script that will take all rows from a database, group similar data in a field, and count the number of groups.
For instance say we have the following rows:
Title - Part No
John's Book - 450-120
John's Book - 450-120
Rob Teeth - 452-134
John's Book - 450-120
Elks Feet - 567-789
Rob Teeth - 452-134
I want to write a query which will take the part number, group it together, and tell me how many times each part number was used.
450-120 (3 times)
452-134 (2 times)
567-789 (1 times)
I have no idea how to do this. I know about the GROUP sql function, but I still have no idea how to count how many in each group.
Thanks in advance for any help.