title: MySQL Help: Good practice for my SQL Query
body: <p>So currently I have a query with 2 sub-queries but with the same table as source.</p>
  
  <pre><code>UPDATE users 
  SET UserFollow=(SELECT COUNT(*) 
                  FROM (SELECT * FROM users) as u1 
                  WHERE u1.ReferralID=users.UserID 
                    AND u1.Activated=0), 
      UserFollower=(SELECT COUNT(*) 
                    FROM (SELECT * FROM users) as u2 
                    WHERE u2.ReferralID=users.UserID 
                      AND u2.Activated=1)
  </code></pre>
  
  <p>It executes at exactly more than 4 milliseconds for me which is a bad practice for SQL Queries. Can someone help me with a more practical SQL Query for this one?</p>
  
  <p>What it basically does is get the count of Activated and Deactivated accounts connected to each individual user account in the users table and save it on UserFollow and UserFollower column on users table.</p>