Suppose I have the following table T1
:
| col1 | col2 | col3 |
|------|------|------|
| 0 | 1 | 1 | // 1
| 1 | 0 | 1 | // 1
| 0 | 1 | 0 | // 0
I now need to iterate every row, create a new table T2
and populate it with a 1
, whenever there are two 1
in a row in T1
.
So the new table T2
would look like:
| res |
|-----|
| 1 |
| 1 |
| 0 |
Should I really iterate through each row, as described here, or is there a more efficient way?