Topic: help! Join problem after upgrade to mysql version 5 (Read 2775 times)
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« on: May 12, 2007, 04:56:47 pm »
Hi,
I have this SQL statement:
Code:
SELECT DISTINCT ss.id, ss.price FROM tpl_screenshots4 AS ss, tpl_keywords AS kw LEFT JOIN tpl_categorie_links AS cat ON ss.id = cat.tpl_id WHERE ss.id = kw.tpl_id AND cat.category = 76 ORDER BY ss.date_added DESC
this works fine in mysql 4.xx but not in mysql 5
I get this strange error:
Quote
#1054 - Unknown column 'ss.id' in 'on clause'
is there something changed in this version what I didn't know?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5778
46265 credits Members referred : 3
« Reply #1 on: May 12, 2007, 05:08:58 pm »
What about this?
Code:
SELECT DISTINCT tpl_screenshots4.id, tpl_screenshots4.price FROM tpl_screenshots4 , tpl_keywords AS kw LEFT JOIN tpl_categorie_links AS cat ON tpl_screenshots4.id = cat.tpl_id WHERE ss.id = kw.tpl_id AND cat.category = 76 ORDER BY tpl_screenshots4.date_added DESC
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #6 on: May 13, 2007, 10:36:50 am »
according the manual it should be:
Code:
SELECT DISTINCT ss.id, ss.price FROM tpl_screenshots4 AS ss JOIN tpl_keywords AS kw LEFT JOIN tpl_categorie_links AS cat ON (ss.id = cat.tpl_id) WHERE ss.id = kw.tpl_id AND cat.category = 64 ORDER BY ss.date_added DESC
and it works (very fast)
I think we need ro learn more about optimization of queries in the new mysql version
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5778
46265 credits Members referred : 3
« Reply #7 on: May 14, 2007, 01:18:35 pm »
I still don't use mysql 5.0 to production servers, but I worked with it for one big project and I was really impressed with how fast is it, especially with big databases.
I still don't use mysql 5.0 to production servers, but I worked with it for one big project and I was really impressed with how fast is it, especially with big databases.
yeah right its really fast, I think I will store the youtube data in the database and stop with the cache files