2 Replies Latest reply on Aug 25, 2006 8:39 AM by Newsgroup_User


      This has annoyed my for a very long time.

      Here is my problem, simplified, I have a todo list for my work, and we have different client and for each client we have a todo list.

      Our database has a table (Sites) with [siteID and site Name]
      and another table (todo_list) with [todoID, Todo_title, Descrition and SiteID] for all the todo items.
      The todo_list.SiteID relates to the Sites.siteID

      What I am trying to do is display each site then loop through each todo task, like this.

      OUTPUT for Sites
      Site Name

      [LOOP through todo_list where SiteID = Sites.siteID]
      Todo Title
      [END LOOP]



      I have been using coldfusion for a while, but cannot get the CFLOOP to work witihn the CFOUTOUT, for another project, I used an if statement to find all the dates under each month, but this dosnet work at all for this problem.

      Could someone be of assistance.

        • 1. Re: CFLOOP within CFOUTPUT
          Level 7
          <cfquery name="siteTasks" ...>
          SELECT SiteName, Todo_title, Todo_Description

          FROM Sites INNER JOIN todo_list ON Sites.SiteID = Todo_List.siteID

          ORDER BY

          <cfoutput query="siteTasks" group="SiteName">
          <li>#ToDo_Title# - #Todo_Description#</li>
          • 2. Re: CFLOOP within CFOUTPUT
            <newbie /> Level 1

            I know this syntax is probably not correct but have thought about doing
            something like this...

            <cfquery name="qTodos" datasource="my_dsn">
            SELECT s.siteId
            , s.siteName
            , tl.Todo_title
            FROM Sites s
            INNER JOIN todo_list tl
            ON s.siteId = tl.siteId
            ORDER BY s.siteId, tl.Todo_title

            <cfoutput query="qTodos" group="siteId">

            Good luck!