I have 2 rows in my SQL 2008 db with these 3 columns
Name | Time_In | Time_Out
Here are the 2 rows
Jim | 2013-05-08 07:00:00.000 | NULL
Pat | 2013-05-08 06:00:00.000 | NULL
Now I want to calculate the SUM in minutes of the time differnces between NOW and the Time_In ------for both Jim and Pat
Example , Lets say its 10:00 now.
That means that Jim has 180 minutes Now (10:00) - Time In (07:00:00.000)
That means that Pat has 240 minutes Now (10:00) - Time In (06:00:00.000)
SO the totals for Jim and Pat are 420 minutes. Thats the number I want.
I started using SELECT SUM(ISNULL(Time Out,NOW)) AS minutes_worked ................
But Im not sure thats the best way to do this.
Any ideas?