LEFT OUTER JOIN Error in MySQL 5

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

On one of my websites I have a query like this...

Code: [ Select ]
 
SELECT
A.column, A.lang_id, A.column3,
B.lang_id, B.column2, B.column3,
C.column, C.column2, C.column3
FROM
table1 A, table3 C
 LEFT OUTER JOIN table2 B ON B.lang_id = A.lang_id
WHERE
A.column4 = 'stuff'
AND A.column5 = C.column
AND C.column4 = 'something'
ORDER BY
B.column2 ASC
 
  1.  
  2. SELECT
  3. A.column, A.lang_id, A.column3,
  4. B.lang_id, B.column2, B.column3,
  5. C.column, C.column2, C.column3
  6. FROM
  7. table1 A, table3 C
  8.  LEFT OUTER JOIN table2 B ON B.lang_id = A.lang_id
  9. WHERE
  10. A.column4 = 'stuff'
  11. AND A.column5 = C.column
  12. AND C.column4 = 'something'
  13. ORDER BY
  14. B.column2 ASC
  15.  


It was working fine in MySQL 4, but I just upgraded to MySQL 5 and it says "Unknown column 'A.lang_id' in 'on clause'" (Where the ON clause starts)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • jacano
  • Born
  • Born
  • jacano
  • Posts: 1

Post 3+ Months Ago

In the mysql version 5 has become very strictly in Joins

after the change from the order of the tables.

the tables are listed in the join must be on both sides of the join.

as relationships Table2 B and A table1 you would have

...
From table3 C, A table1
LEFT OUTER JOIN table 2 B
...
  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

So all I have to do is move the tables around? Weird... I forgot where that query was, I ended up removing something, cannot find it again. But thanks.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 150 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.