Hello, But how can my first query work if the pool-key was not saved anywhere in the database? When I do the same query without the "where pool_key = something", it works: UPDATE radippool SET nasipaddress = '', pool_key = 0,callingstationid = '', expiry_time = current_timestamp - interval '1' second(1); 4 rows updated. SQL> select * from radippool; ID POOL_NAME NASIPADDRESS ---------- ------------------------------ ------------------------------ 1 FOO NAS_PORT ---------- EXPIRY_TIME 26-SEP-06 09.27.54 AM --------------------------------------------------------------------------- USERNAME -------------------------------------------------------------------------------- FRAMEDIPADDRESS 192.168.1.1 POOL_KEY CALLINGSTATIONID ------------------------------ 0 Sorry, in the second query I pasted an old query earlier for you. The second query works, it is: SQL> SELECT framedipaddress FROM radippool WHERE pool_name = 'FOO' AND expiry_time < current_timestamp AND ROWNUM = 1 ORDER BY (select username from radippool where username <> ''), (select callingstationid from radippool where callingstationid <> ''),expiry_time FOR UPDATE; FRAMEDIPADDRESS ------------------------------ 192.168.1.1 Thanks. On 9/26/06, Peter Nixon <listuser@peternixon.net> wrote:
On Tue 26 Sep 2006 14:45, Guilherme Franco wrote:
Hi,
This is what happens:
SQL> UPDATE radippool SET nasipaddress = '', pool_key = 0,callingstationid = '', expiry_time = current_timestamp - interval '1' second(1) WHERE pool_key = '2398432';
0 rows updated.
SQL> SELECT framedipaddress FROM radippool WHERE pool_name = 'FOO' AND expiry_time < current_timestamp AND ROWNUM = 1 ORDER BY (select username from radippool where username <> ''), (select callingstationid from radippool where callingstationid <> ''),expiry_time FOR UPDATE;
no rows selected
So there you go. You found the problem.. Why doesn't it find any rows?
--
Peter Nixon http://www.peternixon.net/ PGP Key: http://www.peternixon.net/public.asc
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html