Guest User

Untitled

a guest
Apr 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. select a.time_stamp / 100000 as bar_time, a.price as bar_open,
  2. b.bar_high, b.bar_low, c.price as bar_close
  3. FROM
  4. (
  5. select max(price) as bar_high, min(price) as bar_low, min(id) as first_id, max(id) as last_id
  6. from [20160104]
  7. where symbol = 'AAPL' and price_field = 0
  8. group by (time_stamp / 100000)
  9. ) as b
  10. join [20160104] as a on b.first_id = a.id
  11. join [20160104] as c on b.last_id = c.id
  12. order by bar_time
Add Comment
Please, Sign In to add comment