How to find the previous value in a similar groups?

Hi All,

Say i have the below scenario, wherever “kr” is there i need those previous values as “sh” and for “sh” of i have the previous value as “sh” then i need as “sh” only. So only for “kr” i need its overall previous value. For example:

column A        output
--------        ------
sh              null
kr              sh
kr              sh
kr              sh
sh              kr
sh              sh
kr              sh
kr              sh

Please help me in this. Thank you in advance!!

Your problem is not yet clear to me. I understand you have a column for which you want to make a test in a second column. Could you please make 5 examples for your the column, which content you want to test and make examples for the results you expect in the second column?

Did you (“Oracle”) study Pythia’s words?

@ROSt53 @Lupp, I have edited the question to display the originally included example. It appears to be some sort of dual-criteria match problem i.e., if prior value in output column is NULL or sh then value is sh UNLESS same row in colA = sh AND previous row in colA = kr? That is the best I can come up with.