On Tue, 2004-02-17 at 11:00, A. Clausen wrote: > I am trying to construct what is proving to be a somewhat tricky SQL query. > I have a database in which wireless activity data is dumped. The following > is a boiled down version of what the table and the contents may look like: > > Date,Unit,InputOctets,OutputOctets,AccountingID > 2004-01-31 23:59:05,0E:3A:0F,10101,3949,SLAKRMMM > 2004-02-01 00:04:07,0E:3A:0F,13843,4192,SLAKRMMM > 2004-02-01 00:09:10,0E:3A:0F,53233,9021,SLAKRMMM > 2004-02-01 00:14:08,0E:3A:0F,2383,109,NX0ADFF > ... > 2004-02-29 23:59:15,0E:3A:0F,481234,18233,LAQ5YN3 [snip] > What I need to do is to find out just how much traffic that unit has done in > the month of February. I realize I will have to do one query to discover > the byte counts for the last record in January, but beyond that I'm stumped.
What about this: select Unit, sum(InputOctets), sum(OutputOctets) from your_table where date between '2004-02-01 00:00:00' and '2004-02-29 23:59:55' group by Unit; -- |- Garth Webb -| |- [EMAIL PROTECTED] -|
signature.asc
Description: This is a digitally signed message part