December 3, 2011 at 4:49 am
select isNull(OverT.OverTH,0)as Hours
from OverT
where convert(Date,OverT.AttendDate) between '2011-11-01' And '2011-11-30'
group by OverT.AttendDate
OverT is OverTime Table, in which OverTH, OverTimeHours are here for employees.
is it possible to make OverTH an aggregate function. BUT there sholud be no effect on its answer, it gives error as OverTH is invalid in the list, because it is not included in any aggregate function or by the group by cluase.
I dont want to include it in group by cluase, as it effect the results
December 3, 2011 at 5:34 am
Please provide table def, sample data and expected result as decribed in the first link in my signature. It will be much more helpful than a verbal description...;-)
December 3, 2011 at 6:54 am
Why are you grouping if you aren't using any aggregate functions? Maybe you're actually looking for SUM(ISNULL(OverT.OverTH,0)) grouped by AttendDate?
December 3, 2011 at 6:57 am
And...this sort of looks like a simplified reposting of this: http://www.sqlservercentral.com/Forums/Topic1215790-391-1.aspx
I'm going to second LutzM and strongly suggest that you provide DDL, sample data, and an example of your desired output in order to help us help you better... 😀
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply