Guest User

Untitled

a guest
May 16th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.50 KB | None | 0 0
  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.     (SELECT
  12.             SUM(price) SUM
  13.         FROM
  14.             payment
  15.         WHERE
  16.             invoice_id = id
  17.         GROUP BY invoice_id)
  18. FROM
  19.     invoice
  20. WHERE
  21.     deleted = 0 AND user_id = 25
  22. HAVING DATE BETWEEN '2014-05-01' AND '2014-05-31'
  23. ORDER BY issue DESC
Advertisement
Add Comment
Please, Sign In to add comment