Adam Meyer
Adam Meyer

Reputation: 1525

unknown column in On clause on simple mysql join

It is probably just too late, but I cant wrap my head around what is wrong

This is giving me an unknown column in ON clause error

SELECT *
FROM abstracts, parts
JOIN parts test ON abstracts.abstract_id = test.abstract_id

But this works perfectly

SELECT *
FROM abstracts, parts
WHERE abstracts.abstract_id = parts.abstract_id

It's a much bigger query, so I can't just use the working example.

Upvotes: 0

Views: 363

Answers (1)

Ariel
Ariel

Reputation: 26773

This:

SELECT *
FROM abstracts, parts
JOIN parts test ON abstracts.abstract_id = test.abstract_id

Should be:

SELECT *
FROM abstracts JOIN parts
  ON abstracts.abstract_id = parts.abstract_id

Upvotes: 1

Related Questions