Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SQL Statement


Message #1 by matjenneson@h... on Mon, 20 Aug 2001 12:42:15
hi, 



I've got an SQL statement in an ASP page which doesn't want to work, does 

anyone have any ideas why? the error message i get is at the bottom.





sqlString = "SELECT  orders.order_userID, Product.Product_Name, 

Product.Product_ID, Product.Product_Picture, Product.Product_BriefDesc, 

COUNT(orders.order_ProductID) AS freq " &_



  "FROM Product, orders " &_



  "WHERE Product.product_category='" & cat & "' " &_



  "AND Product.product_status=1 "&_



  "AND orders.order_userID =" & userID & " "&_



 "ORDER BY freq, Product.Product_Name "



and i get error message:   You tried to execute a query that doesn't 

include the specified expression 'order_userID' as part of an aggregate 

function.



any suggestions? thanks
Message #2 by "Craig Flannigan" <ckf@k...> on Mon, 20 Aug 2001 12:55:42 +0100
The error message reports "order_userID"

but your Where Clause shows "orders_userID"



Could this be the problem?



-----Original Message-----

From: matjenneson@h... [mailto:matjenneson@h...]

Sent: Monday 20 August 2001 12:42

To: ASP Databases

Subject: [asp_databases] SQL Statement





hi,



I've got an SQL statement in an ASP page which doesn't want to work, does

anyone have any ideas why? the error message i get is at the bottom.





sqlString = "SELECT  orders.order_userID, Product.Product_Name,

Product.Product_ID, Product.Product_Picture, Product.Product_BriefDesc,

COUNT(orders.order_ProductID) AS freq " &_



  "FROM Product, orders " &_



  "WHERE Product.product_category='" & cat & "' " &_



  "AND Product.product_status=1 "&_



  "AND orders.order_userID =" & userID & " "&_



 "ORDER BY freq, Product.Product_Name "



and i get error message:   You tried to execute a query that doesn't

include the specified expression 'order_userID' as part of an aggregate

function.



any suggestions? thanks

Message #3 by Ana Sofia Barros Almeida <almeida@n...> on Mon, 20 Aug 2001 14:01:59 +0100
Try this:



sqlString =  ...



 "ORDER BY orders.order_userID,freq, Product.Product_Name "







matjenneson@h... wrote:



> hi,

>

> I've got an SQL statement in an ASP page which doesn't want to work, does

> anyone have any ideas why? the error message i get is at the bottom.

>

> sqlString = "SELECT  orders.order_userID, Product.Product_Name,

> Product.Product_ID, Product.Product_Picture, Product.Product_BriefDesc,

> COUNT(orders.order_ProductID) AS freq " &_

>

>   "FROM Product, orders " &_

>

>   "WHERE Product.product_category='" & cat & "' " &_

>

>   "AND Product.product_status=1 "&_

>

>   "AND orders.order_userID =" & userID & " "&_

>

>  "ORDER BY freq, Product.Product_Name "

>

> and i get error message:   You tried to execute a query that doesn't

> include the specified expression 'order_userID' as part of an aggregate

> function.

>

> any suggestions? thanks




  Return to Index