I have two oracle tables :
USERS : ID, USERNAME, PASSWORD, ROLE
ARCHIVE_POSESSION : ID, USERID, ARCHIVEID
What I'm trying to do is obtain a query that returns me the following result set :
Username, Role, Number Of Archives
So far so good, but I can't wrap my head around the query, I'm still a beginner. So far this is where I got:
SELECT users.ID, USERNAME, ROLE, count(archive_posession.USERID)
from users inner join
archive_posession on
users.id = archive_posession.USERID
group by
archive_posession.USERID ;
But it gives me this error
ORA-00979: not a GROUP BY expression
Any tips? I'm sure group by is supposed to work for aggregate functions, but in this case I'm stoked.