This is a discussion on count text matches within the MySQL forums, part of the Database Server Software category; --> Forgive me, I haven't done many complex SQL calls like this. I have a form where text is entered ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Forgive me, I haven't done many complex SQL calls like this. I have a form where text is entered into the database. First name, middle initial, and last name. I want to be able to do a count on the matches. For example, I have something like this: John A Smith Mike J Nelson Anna K Olsen John A Smith What I want to do is count the number of times that each are in the database. John A Smith would be 2, Mike J Nelson would be 1, etc. How do I do a count in a single table when I don't know what to match to? I don't neccessarly need code, just a direction to look into. |
| ||||
| mtuller wrote: > Forgive me, I haven't done many complex SQL calls like this. I have a > form where text is entered into the database. First name, middle > initial, and last name. I want to be able to do a count on the > matches. For example, I have something like this: > > > John A Smith > Mike J Nelson > Anna K Olsen > John A Smith > > What I want to do is count the number of times that each are in the > database. John A Smith would be 2, Mike J Nelson would be 1, etc. > > How do I do a count in a single table when I don't know what to match > to? I don't neccessarly need code, just a direction to look into. Look at GROUP BY and COUNT(*) |