select sum(val1), ...,
convert(char(9),cdate,112) + convert(char(3),cdate,8) + case when datepart(mi,cdate) < 30 then '00' else '30' end
group by convert(char(9),cdate,112) + convert(char(3),cdate,8) + case when datepart(mi,cdate) < 30 then '00' else '30' end
or you might find it better to create a tally table with the intervals in it and join to that - it will give you the zeroes for no entries.
======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.