I have tables queue and requests. queue’s reqID is a foreign key to requests’ reqID.
both tables have vanID
I am trying to get all the stuff in queue, as well as all the information for each request that queue references. This is my query.
$sql = mysql_query("SELECT queue.*, requests.*
FROM queue
WHERE queue.vanID = '$vanID'
LEFT JOIN requests ON queue.reqID = requests.reqID
ORDER BY rank ASC") or die(mysql_error());
This the error I’m getting.
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 ‘LEFT JOIN requests ON queue.reqID = requests.reqID ORDER by rank ASC’ at line 1
I can’t seem to figure it out, any help?
You were close. The
WHEREclause should go after theLEFT JOIN.