SQL Query question. what's wrong with this query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zykes
    New Member
    • Aug 2006
    • 14

    SQL Query question. what's wrong with this query?

    I have this query that produces Syntax Error(missing operator) in query operation ForumTopics.Top icID = ForumReply.Topi cID LEFT OUTER JOIN
    Members ON ForumTopics.Wri ttenBy = Members.Member_ ID


    this is the query:
    SELECT ForumTopics.Top icID, ForumTopics.Top icName, Members.FName, COUNT(ForumRepl y.ReplyID) AS Reply, MAX(ForumReply. ReplyDate) AS LastPost
    FROM ForumTopics INNER JOIN
    ForumReply ON ForumTopics.Top icID = ForumReply.Topi cID LEFT OUTER JOIN
    Members ON ForumTopics.Wri ttenBy = Members.Member_ ID
    GROUP BY ForumTopics.Top icID, ForumTopics.Top ic, ForumTopics.Cat egoryID, Members.FName
    HAVING (ForumTopics.Ca tegoryID = 1)
    order by LastPost desc;

    What is missing in this query? Need Help please...
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    Don't mix that formumtopics in both the joins.

    Can i know, What u want to select now ?

    :)


    Originally posted by zykes
    I have this query that produces Syntax Error(missing operator) in query operation ForumTopics.Top icID = ForumReply.Topi cID LEFT OUTER JOIN
    Members ON ForumTopics.Wri ttenBy = Members.Member_ ID


    this is the query:
    SELECT ForumTopics.Top icID, ForumTopics.Top icName, Members.FName, COUNT(ForumRepl y.ReplyID) AS Reply, MAX(ForumReply. ReplyDate) AS LastPost
    FROM ForumTopics INNER JOIN
    ForumReply ON ForumTopics.Top icID = ForumReply.Topi cID LEFT OUTER JOIN
    Members ON ForumTopics.Wri ttenBy = Members.Member_ ID
    GROUP BY ForumTopics.Top icID, ForumTopics.Top ic, ForumTopics.Cat egoryID, Members.FName
    HAVING (ForumTopics.Ca tegoryID = 1)
    order by LastPost desc;

    What is missing in this query? Need Help please...

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      You have

      ForumTopics.Top icName

      in select statement and in group by

      ForumTopics.Top ic


      You should group by the same columns that you have in select statement.


      Good Luck.

      Comment

      • zykes
        New Member
        • Aug 2006
        • 14

        #4
        Thanks for the info.... got the solution...

        Comment

        Working...