Jump to content

GROUP BY and ORDER BY together


biohazardep

Recommended Posts

I'm trying to run the next query:

SELECT username, COUNT(item_id) 
FROM (phpbb_lms_items LEFT JOIN phpbb_lms_mochilas ON item_moch=moch_id)
LEFT JOIN phpbb_users ON moch_dueno=user_id
GROUP BY moch_dueno
ORDER BY COUNT(item_id) DESC

 

It works as i want it to in my windows server, but not in my linux server. In the linux box i get the message:

"SQL Error : 1111 Invalid use of group function"

 

The windows server has the following versions:

Apache Web Server Version 2.2.3

PHP Version 5.1.6

MySQL Database Version 5.0.24a

 

The linux one has:

Apache Web Server Version 1.3.33

PHP Version 4.3.11

MySQL Database Version 5.0.18

 

Can anyone help me get it to work in the linux server please?

 

Note: The linux box is from paid hosting, so i can't do much about what versions or features it has. My windows server is only for testing and development before i move my code to the live server (the linux one).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.