Compare 2 resultsets of db-query

From: Date: Mon, 10 Jun 2002 20:09:12 +0000
Subject: Compare 2 resultsets of db-query
Groups: php.general 
Request: Send a blank email to php-general+get-101447@lists.php.net to get a copy of this message
Hi, I've two queries on the same table. They have the following structure: Query1: SELECT FIELD1, COUNT(FIELD2) AS TOTAL from TABLE GROUP BY FIELD1 Query2: SELECT FIELD1, COUNT(FIELD2) AS SUB from TABLE WHERE FIELD2=1 GROUP BY FIELD1 Now I want to print a table that prints the values of FIELD1, TOTAL and SUB. Query 1 returns more rows as query 2. Field1 is the same in both queries so I should be able to 'link' the results of both queries together. How do I do this?? Thanks! Danny

« previous php.general (#101447) next »