Highlighted

Problème avec query group

Participant ,
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

168

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

Problème avec query group

Participant ,
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

169

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
Dec 16, 2016 0
Advocate ,
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
Reply
Loading...
Dec 16, 2016 0
ZNB LATEST
Participant ,
Dec 17, 2016

Copy link to clipboard

Copied

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
Reply
Loading...
Dec 17, 2016 0