suppose Order_tbl have some data as given below
Name orderdt ordertm
-----------------------------------------------------
aaaa 2012-08-08 00:00:00.000 2012-08-08 10:54:15.053
bbbb 2012-08-08 00:00:00.000 2012-08-08 10:54:17.270
cccc 2012-08-08 00:00:00.000 2012-08-08 10:54:18.727
dddd 2012-08-08 00:00:00.000 2012-08-08 10:54:19.117
eeee 2012-08-08 00:00:00.000 2012-08-08 11:54:21.000
ffff 2012-08-08 00:00:00.000 2012-08-08 11:55:21.000
gggg 2012-08-08 00:00:00.000 2012-08-08 10:55:21.663
hhhh 2012-08-08 00:00:00.000 2012-08-08 10:55:21.957
now, check below query for this table
select case when datepart(hour,ordertm)>12 then convert(varchar,datepart(hour,ordertm)-12) +' PM' else convert(varchar,datepart(hour,ordertm)) +' AM' end as hours,
count(*) as Total_orders from Order_tbl
where (orderdt)='2012-08-08' group by datepart(hour,ordertm)
result for date '2012-08-08'
Hours Total_Orders
-------------------------
10 AM 6
11 AM 2
Happy Coding!
:)