From surenkid, 9 Months ago, written in PostgreSQL.
Embed
  1. SELECT CONCAT(u.lastname,u.firstname) "name"
  2. ,i.done_ratio
  3. ,i.subject
  4. ,i.start_date
  5. ,i.due_date
  6. ,i.status_id
  7. ,i.closed_on
  8. ,u.last_login_on
  9. FROM issues i
  10. LEFT JOIN users u ON i.assigned_to_id = u."id"
  11. WHERE CURRENT_DATE BETWEEN i.start_date AND i.due_date
  12. AND i.updated_on > current_date +cast(-1*(TO_NUMBER(to_char(DATE (current_date),'D'),'99')-2) ||' days' as interval)
  13. AND i.status_id>1 --状态不是未开始
  14. ORDER BY i.assigned_to_id;