Monday, January 26, 2015

Seemingly simple SQL query

Hey,


You can refer below query.In my case i have created Table with three columns as Timestamp_col <datetime>,Column_1 <bigint>,Column_2 <varchar(50)>


Below is the required query



Select * from Table_1
where CAST(Timestamp_col as time) IN (Select MAX(CAST(Timestamp_col as time))
from Table_1
Group BY CAST(Timestamp_col as Date))


No comments:

Post a Comment