Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. currency_code | price
  2.  
  3. usd | 50
  4.  
  5. twd | 1570
  6.  
  7. JPY | 5049
  8.  
  9. SELECT * FROM product WHERE price between 0 and 1500
  10.  
  11. SELECT * FROM product WHERE price between 0 and 1500
  12. AND currency_code = $selected_currency_code
  13.  
  14. id |currency_id |price
  15. ----------------------------
  16. 1 |1 |1000
  17. 2 |2 |1500
  18. 3 |1 |1300
  19.  
  20. currency_id | currency_name
  21. --------------------------------
  22. 1 | Dollor
  23. 2 | Euro
  24.  
  25. SELECT price.id,price.price,currency_code.currency_name FROM price
  26. INNER JOIN currency_code ON price.currency_id = currency_code.currency_id
  27. WHERE price BETWEEN 0 AND 1500
  28.  
  29. select driver.*,
  30. case
  31. when driver.rental_currency = 'HKD' then driver_rental.HKT_1_fee_full_day / 7.78
  32. when driver.rental_currency = 'TWD' then driver_rental.HKT_1_fee_full_day / 31.4
  33. when driver.rental_currency = 'CNY' then driver_rental.HKT_1_fee_full_day / 6.67
  34. end
  35. as HKT_1_fee_full_day
  36. from driver_rental
  37. left join driver
  38. on
  39. driver.email = driver_rental.email
  40. where
  41. driver_rental.HKT_1_fee_full_day between 0 and 52
  42. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement