Addressed to: Richard Baskett <[EMAIL PROTECTED]> [EMAIL PROTECTED]
** Reply to note from Richard Baskett <[EMAIL PROTECTED]> Fri, 26 Apr 2002 01:47:17 -0700 > > Is there a way I can combine these queries? > > $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE > typeEmploy='1'"); > $numEmp = mysql_result($result,0); > $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE > typeContract='1'"); > $numCon = mysql_result($result,0); > $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE typeTemp='1'"); > $numTem = mysql_result($result,0); Try: SELECT SUM( IF( typeEmploy = 1, 1, 0 )) AS Employ, SUM( IF( typeContract = 1, 1, 0 )) AS Contract, SUM( IF( typeTemp = 1, 1, 0 )) AS Temp FROM Resumes If type* is always either 1 or 0 you can lose the if: SUM( typeEmploy ) AS Employ ... Rick Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php