search database replace field with value of another field

122 Views Asked by At

yes i am a newbie.

yes i read and tried all posted solutions.

no i can't get it to work in 1 sequence.

problem: coovachilli radius database: 1 field got the wrong information

i want to find a way to find and replace the faulty field with the correct field running as a seperate program or pasted into one of the existing modules

i use and it works manually

update radacct set username = replace username, 'DEFAULT', '???' ;

but how do i replace the ??? with the value of another field (callingstationid) in the same line

or how to get this in in a perl prog with

mysql -u$user -p$pass $database etc etc  
1

There are 1 best solutions below

0
On

found some solution:

file /etc/freeradius/sql/mysql/clients.conf. Just replace every occurrence of the string '%{SQL-User-Name}' With this string IF('%{SQL-User-Name}' = 'DEFAULT', '%{Calling-Station-Id}', '%{SQL-User-Name}') That will replace an empty user name with the MAC address of the request.

referring page: http://www.coova.org/node/4314