Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Problème avec query group

Contributor ,
Dec 16, 2016 Dec 16, 2016

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

387
Translate
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.

Cheers

Eddie

Translate
Advocate ,
Dec 16, 2016 Dec 16, 2016

You need to use a left join.

Cheers

Eddie

Translate
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
Contributor ,
Dec 17, 2016 Dec 17, 2016
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.

Translate
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
Resources