SHARE
TWEET

1

a guest Aug 28th, 2017 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT externalsource,
  2. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 3))
  3. AND TRUNC(current_date) THEN betamount_defcur ELSE 0 END) AS betamount_defcur_month3,
  4. SUM(CASE WHEN TRUNC(calctime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 3))
  5. AND TRUNC(current_date) THEN winamount_defcur ELSE 0 END) AS winamount_defcur_month3,
  6. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 3))
  7. AND TRUNC(current_date) THEN 1 ELSE 0 END) AS month3_bets,
  8. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 6))
  9. AND TRUNC(current_date) THEN betamount_defcur ELSE 0 END) AS betamount_defcur_month6,
  10. SUM(CASE WHEN TRUNC(calctime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 6))
  11. AND TRUNC(current_date) THEN winamount_defcur ELSE 0 END) AS winamount_defcur_month6,
  12. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 6))
  13. AND TRUNC(current_date) THEN 1 ELSE 0 END) AS month6_bets,
  14. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 12))
  15. AND TRUNC(current_date) THEN betamount_defcur ELSE 0 END) AS winamount_defcur_month12,
  16. SUM(CASE WHEN TRUNC(calctime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 12))
  17. AND TRUNC(current_date) THEN winamount_defcur ELSE 0 END) AS betamount_defcur_month12,
  18. SUM(CASE WHEN TRUNC(bettime) BETWEEN TRUNC(ADD_MONTHS(current_date, - 12))
  19. AND TRUNC(current_date) THEN 1 ELSE 0 END) AS month12_bets,
  20. SUM(betamount_defcur) AS betamount_defcur,SUM(winamount_defcur) AS winamount_defcur, COUNT(*) AS bets
  21. FROM externalbet WHERE  punterid=2703275
  22. GROUP BY externalsource;
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top