I have two tables: tweets (a.o. containing column tweet_id) and references (containing columns tweet_id and class_id). Not all tweets might have been assigned a class_id yet. I was expecting this to work to extract all information of a tweet inclusing its class_id (if it has been set):
SELECT t.*, r.class_id FROM tweets t LEFT JOIN references r ON (t.tweet_id = r.tweet_id) ORDER BY t.tweet_id DESC LIMIT 50 However, I keep getting an 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 'references r ON (t.tweet_id = r.tweet_id) ORDER BY t.tweet_id DESC LIMIT 50' at line 1 I don't understand where the error is coming from. I have build the query according to the MySQL documentation (http://dev.mysql.com/doc/refman/5.0/en/left-join-optimization.html) but I am probably missing something?