log N
log N

Reputation: 945

Error Running simple mysql query

I am trying tu run a simple MYSQL query but it throws an error everytime.The query is

SELECT * FROM `user_recommendation` LEFT JOIN `tracking`

user_recommendation and tracking are in the same database and I am running the query under that.The error thrown is

#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 'LIMIT 0, 30' at line 2

I am unable to figure out the reason behind it.

Upvotes: 0

Views: 38

Answers (2)

user1718141
user1718141

Reputation: 97

What is your field that you want to join on that field

you should write your join queries like this :

 SELECT * FROM `user_recommendation` LEFT JOIN `tracking` on `user_recommendation`.id = `tracking`.id

Here we join 2 table on field named id so you should choose a filed that you want to make join on this

Upvotes: 1

Sirko
Sirko

Reputation: 74046

As per MySQL documentation a LEFT JOIN expects an ON or USING condition right after, which you left out in your SQL.

join_table:

table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition

join_condition:

ON conditional_expr

| USING (column_list)

Upvotes: 1

Related Questions