MySQL Forums
Forum List  »  PHP

Re: select statement with count
Posted by: Peter Brawley
Date: November 12, 2019 12:12PM

select u.name, x.N as theCount
from users u 
join (
  select u.id, count(d.userid) N
  from users a
  left join userdocs b on a.id=b.userid
) x using(id);

Options: ReplyQuote


Subject
Written By
Posted
November 09, 2019 07:50AM
November 09, 2019 10:49AM
November 09, 2019 11:22AM
Re: select statement with count
November 12, 2019 12:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.