Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get count of rows

    Hi,

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

    Code:
    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

  • #2
    Regular Coder
    Join Date
    Jun 2011
    Posts
    103
    Thanks
    0
    Thanked 13 Times in 13 Posts

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    See FOUND_ROWS in the MySQL manual if you are not using PHP.
    mysql_num_rows calls the FOUND_ROWS function.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •