19 Replies Latest reply on Feb 22, 2008 9:02 AM by TheScarecrow

    Query Join Code

    TheScarecrow Level 1
      Can anyone tell me why this code returns an error. Whats the correct code? Thanks in advance

      quote:

      <cfquery datasource="#request.dsn#" name="testd">
      SELECT f.forumID, f.forumName, t.forumID, t.topicID, p.topicID, p.postID
      FROM Forums f LEFT OUTER JOIN (SELECT Topics.forumID, COUNT(Posts.postID) as total FROM Topics LEFT JOIN Posts ON Posts.topicID = Topics.topicID GROUP BY Topics.forumID)
      Topics ON Topics.forumID = Forums.forumID
      </cfquery>