boz
|
Posted: 02/22/2004, 8:57 PM |
|
I have two tables set up. One has a status field that changes. The second table has a status and a boolean identifier for that status. I want to be able to count and display the different status by the boolean value.
IE
Table 1
2 records status = yes
2 records status = maybe
2 records status = no
10 records status = Null
Table 2
status yes = boolean true
status maybe = boolean true
status no = boolean false
I want to display:
Total Status | Total Willing | Total No
..........6................4...............2
Any help would be greatly appreciated. I am running CCS, XP, mySQL, Apache, and PHP
|
|
|
Michael Mikkelsen
|
Posted: 02/25/2004, 10:18 AM |
|
Use an SQL Statement similar to this:
SELECT status, COUNT(*)
FROM table1
GROUP BY status;
See http://www.mysql.com/doc/en/GROUP-BY-Functions.html
|
|
|
Michael Mikkelsen
|
Posted: 02/25/2004, 10:23 AM |
|
You can use a JOIN to merge the tables together first if you dont want to display all four types: yes, maby, no, and null
|
|
|
|