I have a query where i need to Update the Top 50 records of a resultset. The way i figured to do this was, Select the Top 50 of the records i want into a temporary table, and then update from the table.
The problem with this is that i need to Order the 50 by Date, so i am getting the 50 oldest records. The Database is in Informix, and you can't select into a temp table with an Order by clause.
To get round this i thought about making it into a sub query, but i just get Syntex Error's
If i could get this first bit right then the update is easy
Any help would be appreciated !!!
-richard
The problem with this is that i need to Order the 50 by Date, so i am getting the 50 oldest records. The Database is in Informix, and you can't select into a temp table with an Order by clause.
To get round this i thought about making it into a sub query, but i just get Syntex Error's
Code:
SELECT Req_id
FROM Fig_Pmt_Requests
WHERE Req_id IN (SELECT FIRST 50 Req_id, req_Created
FROM Fig_Pmt_Requests
WHERE req_status_code = 'PP' AND Req_Type_Code IN('CL','CC','C3') ORDER BY req_Created ASC) INTO TEMP StatusIds
If i could get this first bit right then the update is easy
Code:
UPDATE Fig_Pmt_Requests
SET req_status_code = 'PS'
WHERE Fig_Pmt_Requests.Req_id = StatusIds.Req_id
Any help would be appreciated !!!
-richard