Guest User

Untitled

a guest
Jul 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. SELECT
  2. a.currency,
  3. a.rate,
  4. a.update_date,
  5. b.rate,
  6. b.update_date,
  7. a.rate-b.rate AS trend,
  8.  
  9. (ROUND((a.rate-b.rate)/a.rate)+100,2) AS trend_pct FROM (SELECT * FROM currency_rate WHERE update_date = (SELECT MAX(update_date) FROM currency_rate)) a,
  10.  
  11. (SELECT * FROM currency_rate
  12. WHERE update_date = (SELECT MAX(update_date) FROM currency_rate WHERE update_date < (SELECT MAX(update_date) FROM currency_rate))) b
  13. WHERE a.currency_id = b.currency_id
Add Comment
Please, Sign In to add comment