0 - 1 of 1 tags for daisy chain logic

PFB the table(work_table) created and the data in it:

p_cust p_r_cust p_date
1 2 07/07/2011
2 3 07/09/2011
3 4 07/11/2011

update a
from work_table a ,work_table b
set p_r_cust = b.p_r_cust
where b.p_date >= a.p_date
and b.p_cust = a.p_r_cust
and b.p_r_cust <> a. p_r_cust;

Result table after the first run of the above mentioned query:

p_cust p_r_cust p_date
1 3 07/07/2011
2 4 07/09/2011
3 4 07/11/2011

Result table after the second run of the above mentioned query: