Sql query to create a calculated field
问题 I have a database table like this: I hope I can explain this well, so you can understand. I want to calculate how many hours each employee has worked. For example for "Arjeta Domi" we have Cell(2,3) - Cell(3,3) + Cell(4,3) + Cell(5,3), making the difference of each logOut time with Login time. The final table that I want will have these columns: CardNo , UserName , Date , PauseTime , WorkTime I tried this query: taken from the duplicate SELECT DISTINCT [Card NO], [User Name], ( SELECT MIN