
Write a SQL command to display for each user who has permissions for files of a total size of more than 50: the user’s id, the total size of all the files the user has permissions for, and the user’s password.
I currently have:
SELECT Permission.userID, User.password, SUM(size) AS TotalSize
FROM Permission, File, User
WHERE Permission.userID = User.id AND
Permission.fileName = File.name AND
SUM(size)>50;
The above code is incorrect. I know that by doing SUM(size) it's just adding up all the file sizes and not grouping them by the usersID. Do I need to add a GROUPBY userID?
If someone could help me I would be extremely grateful
This post has been edited by modi123_1: 22 January 2013 - 01:14 PM

New Topic/Question
Reply


MultiQuote







|