I have switched it to sql1: so the statement now reads if("%{sql1: SELECT COUNT(nas_ip) FROM `nas_ip` WHERE nas_ip='%{Packet-Src-IP-Address}' AND realm='adam'}" >0 ) { redundant { sql1 sql2 } } Obviously the redundant section isn't being picked up at the moment which is why it needed to be sql1: or sql2: thanks for that (I will come back to the redundant section at the moment What I need to work out now is how to have the realm working as a variable eg ... AND realm='%{realm}'}"... I am reading the freeradius wiki, specifically http://wiki.freeradius.org/Adding%2C_Removing%2C_Modifying_Attributes_fo r_further_processing Is this the best way to go about this? Assuming the way I am approaching this is possible?! Thanks again Adam King Network Engineer adam.king@intechnology.com InTechnology plc Support 0845 120 7070 Telephone 01423 850000 Facsimile 01423 858866 www.intechnology.com -----Original Message----- From: freeradius-users-bounces+adam.king=intechnology.co.uk@lists.freeradius.o rg [mailto:freeradius-users-bounces+adam.king=intechnology.co.uk@lists.free radius.org] On Behalf Of Ivan Kalik Sent: 17 June 2008 12:26 To: FreeRadius users mailing list Subject: RE: matching on IP Address You have multiple sql instances. Are you sure that instance called "sql" is connecting to that database? Or should it be sql1: or sql2:? Ivan Kalik Kalik Informatika ISP This is an email from InTechnology plc, Central House, Beckwith Knowle, Harrogate, UK, HG3 1UG. Registered in England 3916586. The contents of this message may be privileged and confidential. If you have received this message in error, you may not use, disclose, copy or distribute its content in anyway. Please notify the sender immediately. All messages are scanned for all viruses.