Hi all,

I've the following (sample) Data from my DB.Table:

Datetime Sistema RemotoDesc caudal1
------------------- ------------------- ------------ ---------
2006-06-25 00:00:00 S. Martinho do Porto AC8 10,20
2006-06-25 00:15:00 S. Martinho do Porto AC8 9,70
2006-06-25 00:30:00 S. Martinho do Porto AC8 0,00
2006-06-25 00:45:00 S. Martinho do Porto AC8 0,00
2006-06-25 01:00:00 S. Martinho do Porto AC8 0,10
2006-06-25 01:15:00 S. Martinho do Porto AC8 0,10
2006-06-25 01:30:00 S. Martinho do Porto AC8 0,00
2006-06-25 01:45:00 S. Martinho do Porto AC8 0,00
2006-06-25 02:00:00 S. Martinho do Porto AC8 0,10
2006-06-25 02:15:00 S. Martinho do Porto AC8 0,10
2006-06-25 02:30:00 S. Martinho do Porto AC8 0,00
2006-06-25 02:45:00 S. Martinho do Porto AC8 0,10
2006-06-25 03:00:00 S. Martinho do Porto AC8 0,10
2006-06-25 00:00:00 Aljubarrota Tojeira 7,30
2006-06-25 00:15:00 Aljubarrota Tojeira 6,50
2006-06-25 00:30:00 Aljubarrota Tojeira 4,00
2006-06-25 00:45:00 Aljubarrota Tojeira 4,50
2006-06-25 01:00:00 Aljubarrota Tojeira 4,20
2006-06-25 01:15:00 Aljubarrota Tojeira 4,80
2006-06-25 01:30:00 Aljubarrota Tojeira 3,80
2006-06-25 01:45:00 Aljubarrota Tojeira 3,30
2006-06-25 02:00:00 Aljubarrota Tojeira 3,80
2006-06-25 02:15:00 Aljubarrota Tojeira 2,50
2006-06-25 02:30:00 Aljubarrota Tojeira 2,50
2006-06-25 02:45:00 Aljubarrota Tojeira 2,60
2006-06-25 03:00:00 Aljubarrota Tojeira 3,80
2006-06-25 03:15:00 Aljubarrota Tojeira 2,70
2006-06-25 03:30:00 Aljubarrota Tojeira 2,70
2006-06-25 03:45:00 Aljubarrota Tojeira 2,90
2006-06-25 04:00:00 Aljubarrota Tojeira 5,00
2006-06-25 04:15:00 Aljubarrota Tojeira 2,80
2006-06-25 04:30:00 Aljubarrota Tojeira 2,50
2006-06-25 04:45:00 Aljubarrota Tojeira 3,90

This Data is inserted in a 00:15:00 time resolution as you see. What i need to do is to query data with a time resolution option (on a procedure i'll create.) that should return Data to me by every 30 minute, or every 1 hour, or every 1.30 hour.
So if i do a query Where 'RemotoDesc' = AC8 with a time resolution of 30 min. i want to return something like this:

Datetime Sistema RemotoDesc Sum(caudal1)
------------------- ------------------- ------------ ---------
2006-06-25 00:30:00 S. Martinho do Porto AC8 19,90
2006-06-25 01:00:00 S. Martinho do Porto AC8 0,20
2006-06-25 01:30:00 S. Martinho do Porto AC8 0,00
2006-06-25 02:00:00 S. Martinho do Porto AC8 0,10

Any suggestions on how can i do this and attending the performance issues.

Thanks in advance!
Pago