View Full Version : Change MySQL Query to Count All Rows

01-10-2012, 03:50 AM
Right now I have this query which count the number of partners a user has:

SELECT COUNT(`partner_id`) FROM `partners` WHERE (`user_id` = ${uid} OR `friend_id` = ${uid}) AND `approved` = 1

I need to change this code so it is not specific to any user, but I don't know how. How do I change it to get a list of the counts for all partners?

01-10-2012, 07:30 PM
SELECT COUNT(*) FROM `partners` will return the number of records in a table.