Grouping account stats with a LIKE statement

Steve Bertrand iaccounts at ibctech.ca
Wed Nov 21 15:57:28 CET 2007


This is more a MySQL question rather than a RADIUS one, but I thought
I'd ask here first. For some reason I can't put my head around this issue.

I have NAS's in several different PoP's. Each PoP has it's own
(different) IP block.

What I want to do is modify dialupadmin's tot_stats script. Instead of
having the stats displayed each day for each user on each NAS, I'd like
it to aggregate user stats per NAS *site*.

In essence, in the GROUP BY statement, I'd like a way to have it combine
 by for instance NASGroup as opposed to NASIPAddress.

Is there a way that I can do this type of aggregation with a LIKE
statement on the first pull from radacct within the statement below, or
will I have to perform several SELECT's to do this task?

SELECT UserName,'2007-11-08',COUNT(*),SUM(AcctSessionTime),
  MAX(AcctSessionTime),MIN(AcctSessionTime),SUM(AcctInputOctets),
  SUM(AcctOutputOctets),NASIPAddress FROM radacct
  WHERE AcctStopTime >= '2007-11-08 00:00:00' AND
  AcctStopTime < '2007-11-09 00:00:00' GROUP BY UserName,NASIPAddress;



More information about the Freeradius-Users mailing list