SQL question

Results 1 to 2 of 2

Thread: SQL question

  1. #1
    Join Date
    Dec 1969

    Default SQL question

    I am new to ASP but I have done some things with SQL. I have a project that I am working on where the user will rate books on a 1 to 5 scale and those rateins are put into a table called tblthread.book_rating. I am trying in one SQL command to get an average of that rating from all of the record and update a second table (tblTopic.book_rating) and I am somewhat stuck.<BR><BR>In access I built the following: <BR><BR>SELECT Avg(tblThread.Book_rating) AS AvgOfBook_rating<BR>FROM tblThread<BR>GROUP BY tblThread.Topic_ID<BR>HAVING (((tblThread.Topic_ID)= 6));<BR><BR>which will give me the correct average that I am looking for but when I translate it to ASP as below and run the page I get the following error which I can&#039;t figure out. <BR><BR> strSQL = "UPDATE Avg(tblThread.Book_rating) AS AvgOfBook_rating"<BR> strSQL = "FROM tblThread"<BR> strSQL = "GROUP BY tblThread.Topic_ID"<BR> strSQL = "HAVING (((tblThread.Topic_ID)= " & lngTopicID & "));" <BR> <BR> &#039;Write the updated date of last post to the database<BR> adoCon.Execute(strSQL) <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e14&#039; <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; <BR>expected &#039;DELETE&#039;, &#039;INSERT&#039;, &#039;PROCEDURE&#039;, &#039;SELECT&#039;, or &#039;UPDATE&#039;. <BR><BR>Any and all help will be welcome.....<BR><BR>TIA<BR><BR>Dan Rahenkamp<BR>

  2. #2
    Join Date
    Dec 1969

    Default CROSSPOSTED!

    Please do NOT crosspost! If you don&#039;t know what crossposting is or why it is bad, check out the ASPFAQs (link to them at top right corner of this page) and the category "The Nature of Things".<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts