I need to write a SQL-Server query but I don't know how to solve. I have a table RealtimeData with data:
Time | Value
4/29/2009 12:00:00 AM | 3672.0000
4/29/2009 12:01:00 AM | 3645.0000
4/29/2009 12:02:00 AM | 3677.0000
4/29/2009 12:03:00 AM | 3634.0000
4/29/2009 12:04:00 AM | 3676.0000 // is EOD of day "4/29/2009"
4/30/2009 12:00:00 AM | 3671.0000
4/30/2009 12:01:00 AM | 3643.0000
4/30/2009 12:02:00 AM | 3672.0000
4/30/2009 12:03:00 AM | 3634.0000
4/30/2009 12:04:00 AM | 3632.0000
4/30/2009 12:05:00 AM | 3672.0000 // is EOD of day "4/30/2009"
5/1/2009 12:00:00 AM | 3673.0000
5/1/2009 12:01:00 AM | 3642.0000
5/1/2009 12:02:00 AM | 3672.0000
5/1/2009 12:03:00 AM | 3634.0000
5/1/2009 12:04:00 AM | 3635.0000 // is EOD of day "5/1/2009"
I want to get the EOD's data of days which exist in table. (EOD = end of day). With the my sample's data, I will need to reture a table like following:
Time | Value
4/29/2009 | 3676.0000
4/30/2009 | 3672.0000
5/1/2009 | 3635.0000
Note: I write the comment so that you can know where is EOD. And SQL Server is version 2005.
Note: the data in RealtimeData table is very large with more than 400.000 rows. Please help me to write in optimization.
Please help me to solve my problem. Thanks.