SELECT count(t1.id) as count, sum(t1.total) as total, sum(t1.prepay) as prepay FROM
  purchase as t1
LEFT JOIN domain as t2 on t1.domainId = t2.id
WHERE(
  t2.saleDepartment = %d
  and dateCreated between '%s'
  and '%s'
  and t1.paymentConfirm=1
)