Hello,
This is my first attempt at sql sub queries, so please excuse me if it's something very silly.
Below is my sql:
SELECT td.*, CONCAT(me.First_Name,' ', me.Surname) AS managers_full_name, me.Telephone AS managers_telephone, td.status AS status
FROM `team_details` td
JOIN `members` me ON me.id = td.managers_user_id
JOIN (SELECT COUNT(*) AS nap FROM `team_players`) AS tp ON td.team_id = tp.team_id WHERE tp.status = '1'
WHERE td.entry_year = '2016'
The SQL executed fine before I added the second join with a sub query, now I'm getting the following error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE td.entry_year = '2016' LIMIT 0, 25' at line 5
Is this not the correct way of sub querying, or have I missed something?
Any help would be greatly appreciated.