HosipLan

Untitled

May 16th, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     id,
  3.     issue,
  4.     delivery,
  5.     proforma,
  6.     restoration,
  7.     deleted,
  8.     IFNULL(delivery, issue) AS DATE,
  9.     totalPrice totalPrice,
  10.     ROUND(totalPrice * (1 - discount / 100), 2) AS discountPrice,
  11.     (
  12.     SELECT SUM(payment.price) SUM FROM payment
  13.     WHERE payment.invoice_id = invoice.id
  14.     ) payment_sum
  15. FROM invoice
  16. WHERE invoice.deleted = 0 AND invoice.user_id = 25
  17. HAVING invoice.DATE BETWEEN '2014-05-01' AND '2014-05-31'
  18. ORDER BY invoice.issue DESC
Advertisement
Add Comment
Please, Sign In to add comment