title: Get the COUNT(*) in the case with 'JOIN and WHERE'
body: <p>There are three tables, relationship between them :</p>
  <blockquote>
  <p>'Task' is created by 'employer(uid)'</p>
  <p>'Execution' is complete by 'employee(uid)' and match to 'task(tid)'</p>
  </blockquote>
  <h2>Table 1 - task</h2>
  <pre>
  tid | name        | employer
  ==========================
    1 | Hello world | 1
    2 | Eat food    | 1
    3 | Swimming    | 2
  </pre>
  <h2>Table 2 - user</h2>
  <pre>
  uid | name
  =============
    1 | Salmon
    2 | Bird
    3 | Pig
  </pre>
  <h2>Table 3 - execution</h2>
  <pre>
  eid | task | employee
  ======================
    1 |    1 |        2
    2 |    1 |        2
    3 |    2 |        3
    4 |    1 |        3
    5 |    2 |        2
  </pre>
  <hr />
  <p>Then I do some queries.</p>
  <pre><code>SELECT T1.tid,
      T1.name AS taskName,
      T1.employer AS employerUid,
      T2.name AS employerName,
      COUNT(T3.*)
  FROM task T1, user T2, execution T3
  WHERE T1.employer = T2.uid
      AND T1.tid = T3.task
      AND T1.tid = ( Here can input the task id )
  </code></pre>
  <p>My question :</p>
  <p>I input the <code>'T1.tid = 1'</code> to query, I want to get the <code>COUNT()</code> result that is <code>'3'</code>.</p>
  <pre>
  eid | task | employee
  ======================
    1 |    1 |        2  ---- I want
    2 |    1 |        2  ---- I want
    3 |    2 |        3
    4 |    1 |        3  ---- I want
    5 |    2 |        2
  </pre>
  <p>But SQL always return <code>'5'</code>, I guess the <code>'5'</code> means Table-execution total rows.</p>
  <p>How can I get the <code>COUNT</code> in above case?</p>
  <hr />
  <p>Thanks everyone.</p>