Help with aggregate query

2001-11-12 Thread John Morrissey
I'm logging RADIUS detail records to a MySQL database. Currently, I crunch the the detail table (containing individual records) once a month into another table that contains aggregate usage (monthly_usage). CREATE TABLE monthly_usage ( UserName varchar(32) NOT NULL, Realm varchar(64) NOT

RE: Help with aggregate query

2001-11-12 Thread Johnson, Gregert
:Help with aggregate query I'm logging RADIUS detail records to a MySQL database. Currently, I crunch the the detail table (containing individual records) once a month into another table that contains aggregate usage (monthly_usage

Re: Help with aggregate query

2001-11-12 Thread John Morrissey
On Mon, Nov 12, 2001 at 11:14:21AM -0500, Johnson, Gregert wrote: % SELECT SUM(d.AcctSessionTime) + IFNULL(m.Minutes, 0) % FROM detail d LEFT OUTER JOIN monthly_usage m ON d.UserName = m.UserName % WHERE d.UserName = 'foo'; % % Or, to summarize for all users: % % SELECT d.UserName as user,