I have a database

Ticker, Dt(smalldatetime), open, high, low, close

ie...
TGT 10/14/2010 15:50 53.98 53.98 53.95 53.97
TGT 10/14/2010 15:51 53.97 54.00 53.97 53.99
TGT 10/14/2010 15:52 53.99 54.03 53.99 54.02
TGT 10/14/2010 15:53 54.03 54.05 54.02 54.03
TGT 10/14/2010 15:54 54.04 54.04 54.00 54.00
TGT 10/14/2010 15:55 54.01 54.02 53.99 54.02
TGT 10/14/2010 15:56 54.03 54.06 54.02 54.06
TGT 10/14/2010 15:57 54.06 54.08 54.06 54.08
TGT 10/14/2010 15:58 54.08 54.08 54.03 54.04
TGT 10/14/2010 15:59 54.04 54.06 54.00 54.03
TGT 10/14/2010 16:00 54.07 54.07 54.07 54.07


I am trying to to an sql statement and just can't get it right.

I want to group a range by 5 minute intervals and return the open from the first minute, the close from the last minute and the max for the high between those minutes and the low of the low between the minutes.

Basically returning.
TGT 10/14/2010 15:51 53.97 54.05 53.97 54.02
TGT 10/14/2010 15:56 54.03 54.08 54.00 54.07

I just can't seem to get it right.

Any help is much appreciated I've been racking my brains.