Can you find anything wrong with this query?
SELECT * FROM requests
WHERE id = '".$id."'
LEFT JOIN request_data ON (requests.id = request_data.request_id)
GROUP BY requests.id
Been workingon it for a while but can’t seem to get it right!
The database looks like this:
-requests
-id
-another column
-and a third one
-request_data
-request_id
-key
-value
EDIT: Oh right, and the error:
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 request_data ON (requests.id = request_data.request_id) GROUP BY ' at line 3
Any ideas?
The
WHEREis in the wrong place.You probably don’t need a
GROUP BYeither as theWHEREensures there will only be oneidreturned unless in some way you are relying on the hidden columns functionality (which you shouldn’t as the results are undefined).