Compare previous rows and with another column
Posted: Mon Feb 08, 2016 3:01 pm
All,
Have a question on an issue I am encountering now. Have two columns , ID and Status as below.
ID Status
1 | A
1 | A
1 | R
2 | R
3 | A
3 | R
3 | R
3 | R
Now, I want to compare with previous row and the status column. So, for ID 1, as there is one R(Rejected) but another 2 are Accepted , ID 1 is Accepted. For ID 2 which is only one row, its already R rejected. For ID 3 as there is one Accepted but other 3 are Rejected, its still rejected.
Any lead how to achieve this. Basically for each ID if there is an A then its accepted.
Thanks.
Have a question on an issue I am encountering now. Have two columns , ID and Status as below.
ID Status
1 | A
1 | A
1 | R
2 | R
3 | A
3 | R
3 | R
3 | R
Now, I want to compare with previous row and the status column. So, for ID 1, as there is one R(Rejected) but another 2 are Accepted , ID 1 is Accepted. For ID 2 which is only one row, its already R rejected. For ID 3 as there is one Accepted but other 3 are Rejected, its still rejected.
Any lead how to achieve this. Basically for each ID if there is an A then its accepted.
Thanks.