I have a database which is similiar to
id Date Time
1 2009-08-31 16:00:21
2 2009-08-31 16:00:51
3 2009-08-31 16:01:21
4 2009-08-31 16:01:51
5 2009-08-31 16:02:21
6 2009-08-31 16:02:51
7 2009-08-31 16:03:21
8 2009-08-31 16:03:51
. .
. .
. .
. .
x 2009-08-31 16:30:21 and so on
What sql statement should I write in order to display records that are every
30 minutes?
Thanks for the help!
Regards,
sam
You query may be some thing like this...
select * from table
where datetimecol >= convert(varchar(30),dateadd(mi,-30,GETDATE()),108)
Regards, Balaji
"sam0204" <u56410@uwe> wrote in message news:9f87af27dfbf3@uwe...
frmsrcurl: http://msgroups.net/microsoft.public.sqlserver.programming/Display-data-every-30-minutes-interval
i have another question though
id Date Time Energy
1 2009-08-31 16:00:21 21
2 2009-08-31 16:00:51 23
3 2009-08-31 16:01:21 30
4 2009-08-31 16:01:51 28
5 2009-08-31 16:02:21 28
. . .
. . .
x 2009-08-31 16:30:21 33
. . .
. . .
x 2009-08-31 17:00:21 34
is it possible to get data like
at time 16:00:21 the energy is 21
and time 16:30:21, energy 33
time 17:00:21 energy 34
only need those data that are 30 min interval on that day.
thanks (:
Sorry I am didn't understand your question. Do you need all the records in
the 30 mins duration are only the records in 30th min.
Regards,Balaji
"sam0204" <u56410@uwe> wrote in message news:9f88bccf5bf4b@uwe...
> hi all, thanks for the replies
>
> i have another question though
>
> id Date Time Energy
> 1 2009-08-31 16:00:21 21
> 2 2009-08-31 16:00:51 23
> 3 2009-08-31 16:01:21 30
> 4 2009-08-31 16:01:51 28
> 5 2009-08-31 16:02:21 28
> . .
> . .
> x 2009-08-31 16:30:21 33
> . .
> . .
sorry for the misleading
Balaji wrote:
>Hi Sam,
>
>Sorry I am didn't understand your question. Do you need all the records in
>the 30 mins duration are only the records in 30th min.
>
>Regards,Balaji
>
>> hi all, thanks for the replies
>>
>[quoted text clipped - 22 lines]
>>
>> thanks (:
where datepart(minute,getutcdate()) in (0, 30)
frmsrcurl: http://msgroups.net/microsoft.public.sqlserver.programming/Display-data-every-30-minutes-interval
DATEADD(minute, DATEDIFF(minute, '19000101', dt) /30 * 30.0,
'19000101') AS Interval
FROM tbl
"sam0204" <u56410@uwe> wrote in message news:9f89dda66b4fd@uwe...