|
Posted by Erland Sommarskog on 04/22/06 13:15
(balaji.balaraman@gmail.com) writes:
> Where (( Month like '200501%' ) and (Time between '2005-01-01
> 02:00:00.000' and '2005-01-31 06:00:00.000))
>
> group by month, time
>
> order by month
>
> PRoblem: What I want is all the volume between 2am and 6am on every day
> of the month?
>
> The above query naturaly will give me everything between first and last
> of the month...
convert(char(8), Time, 108) BETWEEN '02:00:00' AND '06:00:00'
You find convert under the topic CAST and CONVERT in Books Online,
where you can see the different format codes (108 in this example) that
are available.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|