Jump to content

What's wrong with this query?


Kemik

Recommended Posts

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.