title: "Every derived table must have its own alias" Error in SQL
body: <p>I have a following SQL query and I'm getting an error "Every derived table must have its own alias.could any one please help me to solve this?</p>
  
  <pre><code>SELECT
      c.clientID_PK,
      c.clientName,
      d1.draftCount,
      d2.purchaseOrderValue,
      d2.averageValue
  FROM client c
  LEFT JOIN
      (select
          COUNT(DISTINCT d.draftID_PK)  as draftCount
       from draft d
       where d.draftDate between NOW() - INTERVAL 90 DAY and NOW())
      )d1 ON TRUE
  LEFT JOIN
      (
       SELECT
          ROUND(sum(p.total_finalValue),2) as purchaseOrderValue
           ROUND((p.poValue / 12),2) as averageValue
       FROM paymentengine_data p
       WHERE p.poDate between NOW() - INTERVAL 90 DAY and NOW()
      )d2 ON TRUE
   WHERE c.typeID_FK = 1 AND c.stateID_FK = 2 AND c.statusID_FK = 2
         AND d1.clientID_FK = c.clientID_PK  AND d2.purchaserID_FK = c.clientID_PK
   GROUP BY c.clientID_PK
  </code></pre>