LEFT OUTER JOIN Error in MySQL 5

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Feb 17, 2005
  • Posts: 1585
  • Status: Offline

Post October 3rd, 2008, 7:02 pm

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)
There's no place like 127.0.0.1, badass part is now it's ::1
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 3rd, 2008, 7:02 pm

  • jacano
  • Born
  • Born
  • No Avatar
  • Joined: Nov 13, 2008
  • Posts: 1
  • Status: Offline

Post November 13th, 2008, 10:38 am

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
  • Joined: Feb 17, 2005
  • Posts: 1585
  • Status: Offline

Post November 16th, 2008, 1:22 pm

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.
There's no place like 127.0.0.1, badass part is now it's ::1

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 197 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.