CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Multiple Value Counting with PHP and mySQL

Print topic Send  topic

Author Message
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

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.