aggregate function

Results 1 to 2 of 2

Thread: aggregate function

  1. #1
    Join Date
    Dec 1969

    Default aggregate function

    Why does this sql not work in my asp page??<BR>sqlstmt = "SELECT Sum(hits) AS [hit], FROM counter ORDER BY"<BR><BR>I get this error:<BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80004005&#039; <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] You tried to execute a query that doesn&#039;t include the specified expression &#039;page&#039; as part of an aggregate function. <BR><BR>/tester.asp, line 17 <BR><BR>Any ideas??<BR>ITWG

  2. #2
    Join Date
    Dec 1969

    Default RE: aggregate function

    I would say that you nees a GROUP BY clause in your query:<BR><BR>SELECT Sum(hits) AS [hit], FROM counter GROUP BY ORDER BY<BR><BR>You can also lose the counter prefixes too, they are not neccessary if you are using only one table:<BR><BR>SELECT Sum(hits) AS [hit], FROM counter GROUP BY page ORDER BY page<BR><BR>This last remark will not solve your problem, but I think the first one will.<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