Hi, I have a database with a table which contains multiple student id's,


+----------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+---------+----------------+
| projID | int(11) | | | 0 | |
| stuID | int(11) | | | 0 | |
| rank | int(11) | | | 0 | |
| uniqueID | int(10) unsigned | | MUL | NULL | auto_increment |
+----------+------------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

most occurring more than once since a student may make multiple requests which are stored in the table. I want to count the number of times each student name occurs, and then store the frequency in an array. I thought that the sql count function would help, but it seems not directly. I had to first do a search to find each unique id (using distinct), then with a for loop iterate through the resultset, and do a search for each id, and then add each numrows value to an array.

I also tried bracketing the second search between two results html with a beginning and ending rows loop, but that doesn't seem to work either!

So, short version is I have the thing working (see attached taf) but seems like a lot of work that should be able to be accomplished in a single select statement.

Thanks for any insights.

John Newsom

Attachment: countnames.taf
Description: application/applefile

Attachment: countnames.taf
Description: Binary data

________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to