Thanks all the below seem to do the trick.

On 06/02/2016 01:58 PM, David G. Johnston wrote:
select max(id) from yourtable where sts=0 and id not in (select ref_id from 
yourtable);

select max(id) from yourtable where sts=0 and id not in (select ref_id from 
yourtable);

--
Stephen Clark

Reply via email to