festinko

Untitled

Sep 8th, 2022
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.29 KB | None | 0 0
  1. SELECT
  2.     YEAR(paymentDateTime) AS year,
  3.     MONTH(paymentDateTime) AS month,
  4.     COUNT(DISTINCT userID) customersWithPayment,
  5.     ROUND(SUM(paymentAmount),2) revenue
  6.    
  7. FROM
  8.     payments
  9.  
  10. WHERE
  11.     paymentStatus = 1
  12.     AND paymentType = 2
  13.    
  14. GROUP BY
  15.     year, month
  16.    
  17. ORDER BY
  18.     year DESC,
  19.     month DESC
Add Comment
Please, Sign In to add comment