Unstoppable Domains

MySQL: Invalid use of group function

Spaceship Spaceship
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.
GoDaddyGoDaddy
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back