Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- id,
- issue,
- delivery,
- proforma,
- restoration,
- deleted,
- IFNULL(delivery, issue) AS DATE,
- totalPrice totalPrice,
- ROUND(totalPrice * (1 - discount / 100), 2) AS discountPrice,
- (
- SELECT SUM(payment.price) SUM FROM payment
- WHERE payment.invoice_id = invoice.id
- ) payment_sum
- FROM invoice
- WHERE invoice.deleted = 0 AND invoice.user_id = 25
- HAVING invoice.DATE BETWEEN '2014-05-01' AND '2014-05-31'
- ORDER BY invoice.issue DESC
Advertisement
Add Comment
Please, Sign In to add comment