Kemik Posted August 18, 2007 Share Posted August 18, 2007 Hello, I've made a page where a user is joining a team. I've successfully added them to the team_members table and adjusted their permissions. I know their user_id and the team_id for the team they wish to join. I want to Select the team leader's email so I can send them an email. The query needs to pull the leader_id from the teams table where the team_id matches $team_id. The query then needs to pull the email from the users table where user_id = leader_id. Here's my current query: SELECT c.leader_id, u.email, FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id WHERE clan_id = $clan_id However my database errors... 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 'FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id ' at line 2 SELECT c.leader_id, u.email, FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id WHERE clan_id = 1 Thanks for your help. Quote Link to comment Share on other sites More sharing options...
js_280 Posted August 18, 2007 Share Posted August 18, 2007 Take out the comma after u.email.... SELECT c.leader_id, u.email FROM clans AS c LEFT JOIN users AS u ON c.leader_id = u.user_id WHERE clan_id = $clan_id Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.