I have table with columns and data as well
Id CardNo IODate IOStatus
==== ======== ========================= ========
1 0004 2011-02-17 10:48:39.000 Entry
2 0004 2011-02-17 10:55:39.000 Exit
3 0004 2011-02-17 11:48:39.000 Entry
4 0004 2011-02-17 15:55:39.000 Exit
I want to get the hours and minutes spent between entry and exit. If the entry is in one date and exit is in the next day it should able to calculate the hours. All this has to be done in sql server.