Problème avec query group

Participant ,
Dec 16, 2016 Dec 16, 2016

Copy link to clipboard

Copied

Bonjour,

Je voudrais faire un forum avec question, réponse, commentaire.

J'ai fait un select avec un query group mais les réponses ne s'affichent que si elle a au moins un commentaire !!

@

<CFQUERY name="Details2" datasource="#session.dbname#">

   SELECT

  

    Forum_Reponse.RID,

    Forum_Reponse.PID,

    Forum_Reponse.Rmessage,

    Forum_Reponse.RDateReponse,

   

    Forum_Comment.CID,

    Forum_Comment.RID,

    Forum_Comment.PID,

    Forum_Comment.Cmessage,

    Forum_Comment.CDateReponse

   

   FROM Forum_Reponse,Forum_Comment

   WHERE Forum_Reponse.PID=9

    And Forum_Reponse.RID=Forum_Comment.RID

   ORDER BY Forum_Reponse.RDateReponse,Forum_Comment.CDateReponse

  </CFQUERY>

.

Merci pour votre aide.

Cordialement

Views

202

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Advocate , Dec 16, 2016 Dec 16, 2016
You need to use a left join.CheersEddie

Likes

Translate

Translate
Advocate ,
Dec 16, 2016 Dec 16, 2016

Copy link to clipboard

Copied

You need to use a left join.

Cheers

Eddie

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 17, 2016 Dec 17, 2016

Copy link to clipboard

Copied

LATEST

Bonjour,

Merci pour votre aide. Cela marche bien !

Voici mon code :

@

<CFQUERY name="Details2" datasource="#session.dbname#">

  SELECT

    Forum_Reponse.RID,

    Forum_Reponse.PID,

    Forum_Reponse.Rmessage,

    Forum_Reponse.RDateReponse,

    Forum_Comment.CID,

    Forum_Comment.RID,

    Forum_Comment.PID,

    Forum_Comment.Cmessage,

    Forum_Comment.CDateReponse

  

FROM Forum_Reponse LEFT OUTER JOIN Forum_Comment

    ON (Forum_Reponse.RID=Forum_Comment.RID)

    WHERE Forum_Reponse.PID=#PID#

    ORDER BY Forum_Reponse.RDateReponse,Forum_Comment.CDateReponse

  </CFQUERY>

Avec un IF dans le 2ème groupe pour s'assurer s'il y a un enregistrement.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines