mysql, count attachment rows each user.

Posted by Nighthawk on Stack Overflow See other posts from Stack Overflow or by Nighthawk
Published on 2010-03-28T10:39:23Z Indexed on 2010/03/28 10:43 UTC
Read the original article Hit count: 156

Filed under:
SELECT
u.userid, u.username,
(SELECT count(*) FROM attachment as a WHERE a.userid=u.userid) as amount
FROM
user
WHERE
AND u.usergroupid=10
ORDER BY amount DESC

© Stack Overflow or respective owner

Related posts about mysql-query