Hello everyone, I have a Realtime table with example data:
Symbol Date Value
ABC 1/3/2009 03:05:01 327 -- is last data for 'ABC'
ABC 1/2/2009 03:05:01 326
ABC 1/2/2009 02:05:01 323
ABC 1/2/2009 01:05:01 313
BBC 1/3/2009 03:05:01 458 -- is last data for 'BBC'
BBC 1/2/2009 03:05:01 454
BBC 1/2/2009 02:05:01 453
BBC 1/2/2009 01:05:01 423
Please help me to write a sql to return last data for all symbol. The result is:
Symbol Date Value
ABC 1/3/2009 03:05:01 327
BBC 1/3/2009 03:05:01 458
P/s: I use sql server 2005. And Realtime data is very big, please optimize the sql code.
Thanks.