MySQL - Group function?

Status
Not open for further replies.

deadimp

New Member
Messages
249
Reaction score
0
Points
0
I'm not a heavy MySQL programmer, and I've only dabbed in it a little. I've just tried to look up some info on a stat utility with this query in the script:
Code:
select stat_browser.id as `id`, sum(hits) as `hits`, max(date) as `date` from (stat inner join stat_browser on stat_browser.id=stat.browser_id) group by browser_id order by sum(hits) desc
And it gives me this error:
Code:
#1111 - Invalid use of group function
I just looked at the MySQL information, and I see that on this server it's 4.x, and on my test server it's 5.x...
Anyone know of any alternatives to group for this?

Edit: Aw heck, now I'm confused. I rearranged so that 'group by' wasn't used, and it's still returning the same error:
Code:
select stat_browser.id as `id`, sum(hits) as `hits`, max(date) as `date` from stat, stat_browser where stat.browser_id=stat_browser.id order by sum(hits) desc
Edit 2: Tested that query on my localhost, and it didn't work. But I'm still confused about the whole group thing.
 
Last edited:
Status
Not open for further replies.
Top