Given the application I'm working on, it will simplify things greatly if these two queries can be combined. Is this possible?
Select organization_name, email from partners
SELECT count(*) as 'referrals' ,partner_id
GROUP BY partner_id
organization_name | email | referrals
I am on my phone now, but if your partners table has a partner_id then you can do something like:
partner_application_stories) AS 'referrals'
partners AS p
INNER JOIN // Returns only matching rows if you want all rows in the p.partner table use LEFT OUTER JOIN or all in right the RIGHT OUTER JOIN
partner_application_stories AS 'pas'
ON p.partner_id = pas.partner_id
GROUP BY pas.partner_id
I won't be at a computer until tomorrow, but give this a try and see if it works for you.
This topic is now archived. It is frozen and cannot be changed in any way.