...

View Full Version : Get count of rows



Kal
07-05-2011, 03:35 PM
Hi,

I have the following query, however need help in modifying it to only return the count of rows that it produces.


SELECT
LEFT(JobLocationPostcode, locate(' ', JobLocationPostcode)) AS postcode,
COUNT(JobStatusCode) AS jobs
FROM
jobs
WHERE
JobId > 125000 AND JobLocationType = 'M' AND JobStatusCode <> 'YA' AND JobWorkBranchId = '22739'
GROUP BY
postcode
ORDER BY
postcode

Any help would be great.

Thanks

Fugix
07-05-2011, 05:03 PM
use mysql_num_rows() (http://us.php.net/manual/en/function.mysql-num-rows.php)

guelphdad
07-05-2011, 05:51 PM
See FOUND_ROWS in the MySQL manual if you are not using PHP.
mysql_num_rows calls the FOUND_ROWS function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum