Re: Search Between Times
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sat, 22 Apr 2006 10:15:12 +0000 (UTC)
(balaji.balaraman@xxxxxxxxx) 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@xxxxxxxxxxxxx
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
.
- References:
- Search Between Times
- From: balaji . balaraman
- Search Between Times
- Prev by Date: Re: Exporting sql data to specific cells
- Next by Date: Re: Sum Accumulating Data
- Previous by thread: Search Between Times
- Next by thread: Re: Search Between Times
- Index(es):
Relevant Pages
|