Click here to Skip to main content
15,919,774 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
SQL
SELECT user_id,SUM(worked_hrs),worked_dte
FROM TimeSheet
where user_leave_id is null AND  timesheet.user_id=106 AND timesheet.worked_dte BETWEEN  '2013-11-01'  AND  '2013-11-30'
GROUP BY worked_dte,timesheet.user_id

union all

SELECT t.user_id,SUM(t.worked_hrs),t.worked_dte
FROM TimeSheet t
join user_leave u on t.user_leave_id =u.user_leave_id
where t.user_leave_id is not null and u.active_rec_in <> 0  and u.leave_status is null and t.user_id=106 AND t.worked_dte BETWEEN  '2013-11-01'  AND  '2013-11-30'
GROUP BY t.worked_dte,t.user_id
Posted
Comments
Maciej Los 16-Dec-13 2:36am    
Use "Improve question" instead posting comments!
Sergey Alexandrovich Kryukov 16-Dec-13 2:36am    
I have no idea how was it possible to get 7:60... :-)
Are you sure you use valid time data types in your database?
—SA
Member 10256268 16-Dec-13 2:38am    
i have sumed this 1.30
3.30
1.00
2.00 hours finally i am getting 7.60 hours it shoulds come 8.00 na
Member 10256268 16-Dec-13 2:42am    
used data type decmail(5,2) for worked_dte column
Sergey Alexandrovich Kryukov 16-Dec-13 10:05am    
That's the problem. You could use DATE type...
—SA

1 solution

Try:
SQL
SELECT t.user_id,CEILING(SUM(t.worked_hrs)),t.worked_dte
FROM TimeSheet t
...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900