473,383 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Problems with grouping and Sort

Hi group
Im currently trying to make a sorta top10 list of people adding certain
items into my database.
Basicly i have a users table (in one database) and the list of
episodes (in another database)
The list of episodes has a user field which identifies the user who
added the specific episode
so i have tried constructing an SQL query that would count how many
rows each user has made in episodes, group them and order them by the
amount they made. I get an error though and was hoping you guys (and
gals) could help me fix it or maybe do it in a more effective way.

mysqlSELECT database1.db_users.username,
count(database2.episodes.user)
-FROM database1.db_users, database2.episodes
-WHERE database1.db_users.user_id = database2.episodes.user
-GROUP BY database2.episodes.user
-ORDER BY count(user) DESC;
ERROR 1111 (HY000): Invalid use of group function
mysql>

any ideas?

Sep 12 '06 #1
2 2969

mi***********@gmail.com wrote:
Hi group
Im currently trying to make a sorta top10 list of people adding certain
items into my database.
Basicly i have a users table (in one database) and the list of
episodes (in another database)
The list of episodes has a user field which identifies the user who
added the specific episode
so i have tried constructing an SQL query that would count how many
rows each user has made in episodes, group them and order them by the
amount they made. I get an error though and was hoping you guys (and
gals) could help me fix it or maybe do it in a more effective way.

mysqlSELECT database1.db_users.username,
count(database2.episodes.user)
-FROM database1.db_users, database2.episodes
-WHERE database1.db_users.user_id = database2.episodes.user
-GROUP BY database2.episodes.user
-ORDER BY count(user) DESC;
ERROR 1111 (HY000): Invalid use of group function
mysql>

any ideas?
untested:

SELECT database1.db_users.username,
count(database2.episodes.user)
FROM database1.db_users, database2.episodes
WHERE database1.db_users.user_id = database2.episodes.user
GROUP BY database1.db_users.username
ORDER BY count(user) DESC;

Sep 12 '06 #2

strawberry wrote:
mi***********@gmail.com wrote:
Hi group
Im currently trying to make a sorta top10 list of people adding certain
items into my database.
Basicly i have a users table (in one database) and the list of
episodes (in another database)
The list of episodes has a user field which identifies the user who
added the specific episode
so i have tried constructing an SQL query that would count how many
rows each user has made in episodes, group them and order them by the
amount they made. I get an error though and was hoping you guys (and
gals) could help me fix it or maybe do it in a more effective way.

mysqlSELECT database1.db_users.username,
count(database2.episodes.user)
-FROM database1.db_users, database2.episodes
-WHERE database1.db_users.user_id = database2.episodes.user
-GROUP BY database2.episodes.user
-ORDER BY count(user) DESC;
ERROR 1111 (HY000): Invalid use of group function
mysql>

any ideas?
untested:

SELECT database1.db_users.username,
count(database2.episodes.user)
FROM database1.db_users, database2.episodes
WHERE database1.db_users.user_id = database2.episodes.user
GROUP BY database1.db_users.username
ORDER BY count(user) DESC;
thx but it still complains about the ERROR 1111 invalid use of the
group function.

Sep 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mike King | last post by:
I don't know how to group the following data in the way I want it. I want the output of the transformation to be "5678". Does anyone know what I am doing worry? <?xml version="1.0"?> <data>...
2
by: Tristan Miller | last post by:
Greetings. I have a question involving sorting and grouping output using XSLT. I am trying to produce a publication list from a BibTeX-like XML file: <bibxml:file...
4
by: kristofera | last post by:
I am trying to do a distinct grouping of some nodes sorted by a numeric value but for some reason the distinct (preceding-sibling filter) is applied to the result as if not sorted. If I don't use...
0
by: Stephen | last post by:
I have the following xslt and I am trying to use two levels of grouping. I am first grouping on the report category, then on the report type. The problem is I am sure I have to apply some sort of...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
8
by: Jean | last post by:
Hello all, I have the following data, that was queried and sorted to columns PROBLEM_ID and then by STATUSDATE (ascending): STATUS_ID STATUSDATE PROBLEM_ID --------- ---------- ...
0
by: DAnne | last post by:
Hi, I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols. I have to do a tally report. This report is divided up into sections....
3
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
2
by: viral612 | last post by:
Hi, someone pls help me on this. following is my xml... I need to take out papers for each type separately. and then this each type should have area seperately. which means: there are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.