title: subquery as the from for mysql
body: <p>What am I doing wrong here?  Trying to use a subquery as my FROM to ensure all joined tables are joined on the correct set.</p>
  
  <pre><code>  SELECT
      active_users.username as username,
      active_users.computer_name as computer_name,
      alert.cnt as alerts
  
    FROM
      (SELECT
          computer_name,
          username
        FROM computers
  
        INNER JOIN users
          on users.computer_id = computers.computer_id
  
        WHERE computers.account_id = :cw_account_id AND computers.status = :cw_status
      ) AS active_users
  
      LEFT JOIN
        (SELECT
            user_id,
            count(*) as cnt
          from logs
          group by user_id
        ) AS alert
        on alert.user_id = active_users.user_id
  </code></pre>