Rewrite mysql 5 query to v.4

Hi,

I’ve got this query:

 DELETE FROM `scms_profiles_log`
 WHERE `pID` = '938' 
AND `ID` NOT IN (SELECT * FROM (SELECT `ID` FROM `scms_profiles_log` 
WHERE `pID` = '938' 
ORDER BY `ID` 
DESC LIMIT 4) AS TAB)

How can I make this work in mysql 4?

do it with 2 queries – the first to return the 4 ids, and the second to delete the rows that aren’t one of those 4