SHARE
TWEET

Untitled

a guest Oct 13th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     customer_id,
  3.     customer_name,
  4.     COUNT(rental_id)+COUNT(payment_id) AS discount_point,
  5.     CASE
  6.         WHEN COUNT(rental_id)+COUNT(payment_id) < 41 THEN '10%'
  7.         WHEN COUNT(rental_id)+COUNT(payment_id) > 59 THEN '30%'
  8.         ELSE '20%'
  9.     END AS discount
  10. FROM customer_derived
  11. GROUP BY customer_id, customer_name
  12. ORDER BY customer_id, customer_name;
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