Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jj32smith
Starting Member
7 Posts |
Posted - 2007-06-27 : 20:13:29
|
| I have a table that has Employee Number, Beginning Work DateTimeBeginning LunchDateTimeEnding LunchDateTimeEnding Work Date TimeI would like to create a select statement for a giving date range that brings back the total hrs worked over that data range.Can someone help me with this query?Thanks |
|
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2007-06-27 : 20:41:57
|
| What have you tried so far? |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-27 : 21:18:19
|
| Post some sample code and expected result so what we understand is same as what you want.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
jj32smith
Starting Member
7 Posts |
Posted - 2007-06-27 : 22:54:27
|
| Here is what I have so far but, this brings back every entry for the specific employeeSELECT EMPNO, BEGWRK, BEGLUN, ENDLUN, ENDWRK,((ENDWRK - BEGWRK)- (ENDLUN-BEGLUN))FROM EMPHOURSWHERE EMPHOUR.EMPNO='123' or EMPHOUR.EMPO = '125')I would like the query to only bring back one record for each employee and the total hrs wrked for this employee.Thanks for your help. |
 |
|
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2007-06-27 : 23:44:17
|
quote: Originally posted by jj32smith I have a table that has Employee Number, Beginning Work DateTimeBeginning LunchDateTimeEnding LunchDateTimeEnding Work Date TimeI would like to create a select statement for a giving date range that brings back the total hrs worked over that data range.Can someone help me with this query?Thanks
What do you mean by "over that data range"? |
 |
|
|
|
|
|