What database system are you using? This forum is for Microsoft SQL Server, so expertise on Oracle, MySQL etc. is rare. If you were using Microsoft SQL Server, this is how I would write it. I don't think this would work in other RDBMS because of the DATEADD and DATEDIFF functions not being available on those.SELECT DATEADD(mi,DATEDIFF(mi,0,o.dt)/30*30,0) AS hr_dy , COUNT(o.membership_num) AS tlFROM [table] oWHERE o.dt >= '20140325' AND o.dt < '20140326'GROUP BY DATEADD(mi,DATEDIFF(mi,0,o.dt)/30*30,0);