Magic thank you this has sorted the problem with excellent results. Please tell me where you would like some money to be sent as your help pointed me in the right direction.
-----Original Message----- From: freeradius-users-bounces+jonathan.bastin=peerpointinternet.co.uk@lists.freer adius.org [mailto:freeradius-users-bounces+jonathan.bastin=peerpointinternet.co.uk@lis ts.freeradius.org] On Behalf Of Fajar A. Nugraha Sent: 15 October 2012 01:40 To: FreeRadius users mailing list Subject: Re: Query help On Mon, Oct 15, 2012 at 7:35 AM, Fajar A. Nugraha <l...@fajar.net> wrote: > If yes, it should be MUCH quicker to simply do the comparison INSIDE > the sql statement. Something like (untested, should work for mysql): > > if ("%{sql: ( (SELECT radgroupcheck.value FROM radusergroup Inner Join > radgroupcheck ON radusergroup.groupname = radgroupcheck.groupname > WHERE radusergroup.username = '%{User-Name}' AND > radgroupcheck.attribute = 'CS-Total-Octets-Monthly' LIMIT 1) <= > (SELECT SUM( AcctInputOctets + AcctOutputOctets) FROM radacct WHERE > UserName='%{User-Name}' AND AcctStartTime > > (DATE_SUB(CURDATE(),INTERVAL DAYOFMONTH(CURDATE())DAY))) ) as > overlimit" } == 1 ){ Sorry, it should be something like if ("%{sql: SELECT ( ( SELECT your_limit_query ) <= ( SELECT your_acct_query ) ) as overlimit;"} == 1 ) My first example is (obviously) missing the first select, but you get the idea :) -- Fajar - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html -------------------------------------------------------------------------------------------------------------------------- This email (including any attachments) is intended only for the recipient(s) named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not the named recipient please contact the sender and delete the email from your system. The author's incumbent expressions, views and thoughts are their own and not necessarily representative of those of the Peer Point Internet Ltd or associated companies. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html