I have following data in my table.
Running below query through script and giving me different results every time when I execute. For example rptind for id 2, some times it gives 'P' and some times its 'n'. Not sure why it is changing the value for this rptind.
if I execute manually, I see same results always.
select id,eff_dt,ind,rptind,row_number() over
(partition by id order by(case when ind="ok" then 1 when ind="no" then 2 when ind="not" then 3 end))
as rnk from tmp1 order by id;
Not understanding why it is behaving like this. Can someone suggest what might be the cause of this issue.
Thank you, Babu