SHARE
TWEET

Untitled

a guest Aug 20th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT (CASE
  2.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 0 AND 15 THEN '0-15'
  3.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 16 AND 30 THEN '16-30'  
  4.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 31 AND 45 THEN '31-45'
  5.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 46 AND 60 THEN '46-60'
  6.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 61 AND 90 THEN '61-90'
  7.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 91 AND 180 THEN '91-180'
  8.         WHEN DATEDIFF(NOW(), bill_date) BETWEEN 181 AND 365 THEN '181-365'
  9.         WHEN DATEDIFF(NOW(), bill_date) >= 366 THEN '> 365
  10.             END
  11.         ) as bill_range,
  12.         SUM(pending_amount) as amount_due,
  13. FROM
  14.     `user`
  15.     GROUP BY bill_range
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top