Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- a.currency,
- a.rate,
- a.update_date,
- b.rate,
- b.update_date,
- a.rate-b.rate AS trend,
- (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,
- (SELECT * FROM currency_rate
- WHERE update_date = (SELECT MAX(update_date) FROM currency_rate WHERE update_date < (SELECT MAX(update_date) FROM currency_rate))) b
- WHERE a.currency_id = b.currency_id
Add Comment
Please, Sign In to add comment