problem sql query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grabit
    New Member
    • Mar 2007
    • 22

    problem sql query

    Hi Mary
    this is the problem child (query)
    <!---Query db for page info--->
    <cfquery name="showtopic s" datasource="par rots">
    SELECT categories.catI D, threads.threadI D, threads.posttyp e, threads.topic, threads.topicID , threads.memberI D, threads.usernam e, threads.postdat e, categories.cate gory, T2.CountReplies
    FROM (categories LEFT JOIN threads ON categories.catI D = threads.catID) LEFT JOIN (SELECT topicID, Sum(IIf([posttype]=2,1,0)) As CountReplies
    FROM threads GROUP BY topicID) AS T2 ON threads.topicID = T2.topicID
    WHERE categories.catI D=#url.catID# AND (posttype=1 OR posttype Is Null)
    ORDER BY threads.threadI D DESC;
    </cfquery>

    The error i get is in dreamweaver when i try to list the contents of a recordset in the bindings panel - when i click on the little plus sign i get this error which includes this

    -1:[Macromedia][SequelLink JDBC Driver][obdc Socket][Microsoft][OBDC Microsoft Access Driver]
    Syntax error (missing operator) in query expression 'categories.cat ID=AND (postype=1 OR posttype Is Null)'


    java .sql.SQLExcepti on: [Macromedia][SequelLink JDBC Driver][obdc Socket][Microsoft][OBDC Microsoft Access Driver]
    Syntax error (missing operator) in query expression 'categories.cat ID=AND (postype=1 OR posttype Is Null)'
    Last edited by grabit; Jun 3 '07, 02:44 AM. Reason: add to post
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    OK as the error you are getting is ...

    Code:
    syntax error (missing operator) in query expression 'categories.catID=AND (postype=1 OR posttype Is Null)'
    Then #url.catID# isn't returning anything

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by mmccarthy
      OK as the error you are getting is ...

      Code:
      syntax error (missing operator) in query expression 'categories.catID=AND (postype=1 OR posttype Is Null)'
      Then #url.catID# isn't returning anything
      Yes, that's right. Check the URL for "catID=". You'll probably see that it's empty, or, if you've used cfparam for default values, it doesn't exist at all.

      Comment

      Working...