John Lester
02-04-2013, 03:09 PM
The goal ... find how many users used "man" in their biography field in their profile. Then to change their usergroupid (I can do that much once I understand why the following SELECT query is wrong).
I've been messing around with this query ... but I'm still not familiar enough with JOIN statements to understand why it keeps throwing a syntax error.
#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
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.
I'm using phpmyadmin and have the delimiter ; in the delimiter box hence it not being in the query above.
I've been messing around with this query ... but I'm still not familiar enough with JOIN statements to understand why it keeps throwing a syntax error.
#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
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.
I'm using phpmyadmin and have the delimiter ; in the delimiter box hence it not being in the query above.