SHARE
TWEET

Untitled

a guest Oct 14th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     full_name,
  3.     jumlah_peminjaman, (
  4.     CASE WHEN (jumlah_peminjaman < 40) THEN '10%'
  5.         WHEN (jumlah_peminjaman >= 40) AND (jumlah_peminjaman < 60) THEN '20%'
  6.         WHEN (jumlah_peminjaman >= 60) THEN '30%'
  7.     END) AS diskon
  8. FROM (
  9.     SELECT
  10.         CONCAT(first_name,' ',last_name) AS "full_name",
  11.         COUNT(rental.rental_id)+COUNT(rental.payment_id) AS jumlah_peminjaman
  12.     FROM
  13.         customer INNER JOIN rental ON (customer.customer_id = rental.customer_id)
  14.     GROUP BY first_name, last_name
  15. ) AS T1
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