Dynadot โ€” .com Transfer

MySQL: Invalid use of group function

SpaceshipSpaceship
Watch

evdoxos

Established Member
Impact
0
I have problem with the following query:

SELECT product.prod_id, product.title, product.thumb, product.price
FROM product, order_detail
WHERE product.prod_id=order_detail.product_id
GROUP BY order_detail.product_id
ORDER BY SUM(order_detail.quantity);

On my computer (MySQL 5.0.51a) it works fine.

But on my server (MySQL 4.1.22) I get the msg:"invalid use of group function". Only if I remove the "ORDER BY SUM(order_detail.quantity)" it works.

Can you help me?

I fixed it:

SELECT product.prod_id, product.title, product.thumb, product.price, SUM(order_detail.quantity) AS quantity_sum
FROM product, order_detail
WHERE product.prod_id=order_detail.product_id
GROUP BY order_detail.product_id
ORDER BY quantity_sum;
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back