if(!"%{sql:SELECT COUNT(*) FROM radcheck WHERE username == '%{SQL-User-Name}' AND attribute = 'Calling-Station-ID'}" <= 0){ if("%{sql:INSERT INTO radcheck (username,attribute,op,value) VALUES ('%{SQL-User-Name}','Calling-Station-ID','==','%{Calling-Station-ID}')}" >= 1){ updated } else { noop } } else { noop }