MySQL 5 - Time to stop being lazy
Posted: Mon Jan 08, 2007 7:07 am
Today I ran one of my sites using MySQL 5 as a backend.
Oh deary me.
That wasn't good. It turns out that MySQL 5 really doesn't like my lazy JOIN syntax at all. Throughout my sites I have tables joined together like:
It's quick, it's easy to understand, and it doesn't work in MySQL 5. If you're mixing join types you have to specify all of them explicitly, eg:
So... if, like me, you're used to using commas to join tables, I suggest you stop and start learning the proper syntax instead. Or you'll be rewriting a whole heap of SQL when you eventually come to upgrade.
Oh deary me.
That wasn't good. It turns out that MySQL 5 really doesn't like my lazy JOIN syntax at all. Throughout my sites I have tables joined together like:
Code: Select all
select * from user, country
LEFT JOIN privs on privs.user_id = user.user_id
WHERE
user.country_id = country.country_idCode: Select all
select * from user
INNER JOIN country ON user.country_id = country.country_id
LEFT JOIN privs ON privs.user_id = user.user_id