Advertisement
festinko

Untitled

Sep 29th, 2022
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.45 KB | None | 0 0
  1. SELECT
  2.     userSMSRefill,
  3.     ROUND(SUM(paymentAmount)) revenue
  4.    
  5. FROM
  6.     payments p
  7.     LEFT JOIN users u
  8.     on p.userID = u.userID
  9.    
  10. WHERE
  11.  
  12. paymentDateTime > '2022-07-13 00:00:01'
  13. AND p.userID IN (
  14.     SELECT
  15.                  userID
  16.                 FROM
  17.                         alertcontacts
  18.                        
  19.                 WHERE
  20.                         alertContactType IN (8,14)
  21.                         AND alertContactStatus = 2
  22.                        
  23.                 GROUP BY
  24.                                 userID
  25.                 ORDER BY
  26.                         userID)
  27. AND paymentType = 1
  28.  
  29. GROUP BY
  30.     userSMSRefill
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement