MySQL: Invalid use of group function

NamecheapNamecheap
Namecheap AuctionsNamecheap Auctions
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.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back