Quote:
Originally Posted by John Lester
#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 user AS user ON (userfield.userid = user.userid) AND usergroupid = 2 A' at line 2
Query
Code:
SELECT * FROM userfield WHERE field1 = 'man'
LEFT JOIN user AS user ON (userfield.userid = user.userid)
AND usergroupid = 2
AND posts = 0
There is no "user" or "usergroupid" column in the userfield table ... only userid hence my reasoning to join the user table.
|
You've got the query in the wrong order, the where clause has to come after all the tables are joined.
Code:
SELECT * FROM userfield
LEFT JOIN user AS user ON (userfield.userid = user.userid)
WHERE field1 = 'man'
AND usergroupid = 2
AND posts = 0