I have two times First and Last ..I need a query that shows the time difference and if the GETDATE() =now then it should say In progress. Like if it is a day before then it should say '12 hours 10 Min left' and if it is happening now it should say 'In progress' and if it has passed then it should state 'Passes'
I have tries a few queries but I am not getting the desired result.
Thank you !
asked Sep 14, 2013 at 02:41 AM in Default
I think the basic logic would check for your three possible states - before, during or after, then return the state in english
For parsing the time span into english, check out the Working with Time Spans and Durations in SQL Server article on SQLTeam - http://www.sqlteam.com/article/working-with-time-spans-and-durations-in-sql-server
The crux of the article is this list of calculations:
answered Sep 15, 2013 at 03:07 AM