Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- YEAR(paymentDateTime) AS year,
- MONTH(paymentDateTime) AS month,
- paymentPeriod,
- productValue,
- COUNT(DISTINCT userID) customersWithPayment,
- ROUND(SUM(paymentAmount),2) revenue
- FROM
- payments p
- LEFT JOIN
- products pr
- ON p.productID = pr.productID
- WHERE
- paymentStatus = 1
- AND paymentType = 2
- GROUP BY
- year, month, paymentPeriod, productValue
- ORDER BY
- year DESC,
- month DESC,
- paymentPeriod,
- productValue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement