At 10:06 AM 3/30/01 -0800, Larry Rivera wrote:
>I think you have to run multiple queries, ie run some loop after finding out
>what topics you wil count from e==>
>
>run a select distinct to get the topics
>run a while or for loop then run queries again like count(*) where
>topic='$topic'

   Better yet (and less db-intensive), run a

SELECT TOPIC,COUNT(*) FROM table_name
   WHERE condition
   GROUP BY TOPIC
   ORDER BY COUNT(*);

That'll return:

  TOPIC    COUNT(*)
  -------- --------
  Topic A         8
  Topic B         3
  Topic C         1
  Topic D         0
  Topic E         0


  -------------------------------------
    Brian S. Dunworth
    Sr. Software Development Engineer
    Oracle Database Administrator
    The Printing House, Ltd.

    (850) 875-1500  x225
    <[EMAIL PROTECTED]>
  -------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to