You are here: Strange error with multiple left joins in query « PHP SQL « IT news, forums, messages
Strange error with multiple left joins in query

Posted by pieter.thoma on 10/28/07 21:43

Hi,

I'm having a query doing some left joining on some tables, and for
some strange reason, when adding another join, the query is not
executed anymore by mysql_query(). If I logon to the mysql server, I
can still execute & see the query, so the query syntax is fine. Is
there a limitation on the maximum length of query in mysql_query()?

This works:

SELECT t1.client_id, t1.client_name, t2.project_id,
CONCAT(t3.definition_name,'_',t2.project_number) AS `project_name`,
t2.project_title, t4.exp_id, CONCAT('EXP_',t4.exp_number) AS
`experiment_name`, t4.exp_title, t5.separation_id,
CONCAT(t6.separation_technology_name,'_',t5.separation_differential,t5.separation_number)
AS `separation_name` FROM `dir_clients` AS t1 LEFT JOIN `dir_projects`
AS t2 ON t1.client_id = t2.client_id LEFT JOIN
`dir_project_definition` AS t3 ON t2.project_definition_id =
t3.definition_id LEFT JOIN `dir_project_experiments` AS t4 ON
t2.project_id = t4.project_id LEFT JOIN `dir_separations` AS t5 ON
t4.exp_id = t5.experiment_id LEFT JOIN `dir_separation_technology` AS
t6 ON t5.separation_technology = t6.separation_technology_id GROUP BY
t1.client_id, t2.project_id, t4.exp_id, separation_name ORDER BY
t1.client_name, project_name, experiment_name, separation_name

This doesn't anymore:

SELECT t1.client_id, t1.client_name, t2.project_id,
CONCAT(t3.definition_name,'_',t2.project_number) AS `project_name`,
t2.project_title, t4.exp_id, CONCAT('EXP_',t4.exp_number) AS
`experiment_name`, t4.exp_title, t5.separation_id,
CONCAT(t6.separation_technology_name,'_',t7.differential_letter,t5.separation_number)
AS `separation_name` FROM `dir_clients` AS t1 LEFT JOIN `dir_projects`
AS t2 ON t1.client_id = t2.client_id LEFT JOIN
`dir_project_definition` AS t3 ON t2.project_definition_id =
t3.definition_id LEFT JOIN `dir_project_experiments` AS t4 ON
t2.project_id = t4.project_id LEFT JOIN `dir_separations` AS t5 ON
t4.exp_id = t5.experiment_id LEFT JOIN `dir_separation_technology` AS
t6 ON t5.separation_technology = t6.separation_technology_id LEFT JOIN
`dir_separation_differential` AS t7 ON t5.separation_differential =
t7.differential_id GROUP BY t1.client_id, t2.project_id, t4.exp_id,
separation_name ORDER BY t1.client_name, project_name,
experiment_name, separation_name

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация