let say i have table look like below
actionTable
-----------
id, user, actionName, time
1 , userX, startdoing, 1/1/2010 9am
2, userX, endDoing, 2/1/2010 10am
may i know whether possible to use 1 sql select statement to minute record 2 from 1 and get time spent ? or use hibernate.criteria to do this?
something like this for hours
give me this:
changing to
datediff(minute,s.time,e.time)gives thisthis will work for an entire table of users and their start and end times if you only have one start and end time for each… if you don’t have only one then it gets a little more complicated — the easy way (with mssql 2005+) is to do something like like this: