I have some tables which basically look as follows:
TBL_USER
user_id - number
user_name - varchar
TBL_STUFF
stuff_id - number
stuff_user_id - number
I want to query for all user information including the number of “stuff” they have. I was trying something like this:
select user_id, user_name, count(stuff_id)
from tbl_user
left outer join tbl_stuff on stuff_user_id = user_id
where user_id = 5;
but I get an error which says “not a single-group group function”
Is there some other way I should be doing this?
You could also do it like this: