RE: [PHP-DB] MySQL Query

From: Date: Fri, 03 Nov 2000 17:29:58 +0000
Subject: RE: [PHP-DB] MySQL Query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4195@lists.php.net to get a copy of this message
Something like this might work: $sql = "select (quantity / sum(quantity)) as 'Percent of Total' from table_name"; Jason Stechschulte jpstech@nc.edu -----Original Message----- From: Gary Robinson [mailto:grobinso@autocraft.com] Sent: Friday, November 03, 2000 11:08 AM To: php-db@lists.php.net Subject: [PHP-DB] MySQL Query I need to perform a query that calculates a percentage of the total: Type Quantity Percent of Total Brown 50 25.00 White 25 12.50 Red 100 50.00 Blue 25 12.50 Is this possible within a query or will I need to write some code (i.e., PHP, etc.) to accomplish the task? Thanks for the help, in advance! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#4195) next »