I have a simple query that I must have framed incorrectly, because MySQL
returns an error:

SELECT c.customerID,CONCAT(...) as Cust FROM customers c,invoice i WHERE
c.customerID = i.customerID ORDER BY COUNT(i.customerID) LIMIT 0,10;

This tells me ERROR 1111: Invalid use of group function

How can I get the ordering that I want? My goal is to select my ten most
frequent customers. I tried adding the COUNT() clause into the column
list, but then MySQL wanted a GROUP BY clause. When I added a group by
clause, I couldn't keep the ORDER BY clause...
Can anyone help?

Thanks, this is much appreciated, since I know I have a pretty simple
problem.

Quinten


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to