Bonjour à tous.
j’ai un soucis avec une requête MySQL sur la version 5.5
Avant je faisais cela :
//---------------------------------------------------------------------
// MySQL : 5.1.73-1
//---------
SELECT c.*, a.*,
IF(c.content_id_usr = 0, ((SELECT a.content_usr_var1 FROM zw_contents_anonymes a WHERE a.content_content_id = c.content_id_join), NULL)) AS content_usr_var1,
IF(c.content_id_usr = 0, ((SELECT a.content_usr_var2 FROM zw_contents_anonymes a WHERE a.content_content_id = c.content_id_join), NULL)) AS content_usr_var2
FROM zw_contents c, zw_contents_anonymes a
WHERE c.content_tree_id = 100;
J’ai essayé çà :
//---------------------------------------------------------------------
// MySQL : 5.5.53-0
//---------
SELECT c.*, a.*,
IF(c.content_id_usr = 0, "pseudodNyme", NULL)) AS content_usr_var1
FROM zw_contents c, zw_contents_anonymes a
WHERE c.content_tree_id = 100;
SELECT c.*, a.*,
IF(c.content_id_usr = 0, "pseudodNyme", NULL)) AS content_usr_var1,
FROM zw_contents c
LEFT JOIN zw_contents_anonymes a ON c.content_id_join = a.content_content_id
WHERE c.content_tree_id = 100;
SELECT c.*, a.*,
CASE WHEN c.content_id_usr = 0 THEN 'pseudodNyme' ELSE NULL END AS content_usr_var1
FROM zw_contents c
LEFT JOIN zw_contents_anonymes a ON jc.content_id_join = a.content_content_id
WHERE c.content_tree_id = 100;
Je recherche, je recherche…
Si vous avez une idée En vous remerciant.
Romain