Say you have a time registration system in your plant that registers when people use their badges to check in and out. And say you want to calculate the actual time that people have been present.
I had to solve this issue for a SQL Server 2000 database. The solution of course works for newer versions as well and I am very interested in other solutions.