i have temp table with a set of data
-----------------------------------------------------
| col1 | col2 | col3 | col4 | status|
-----------------------------------------------------
| a | a12 | dd | ff | 1 |
-----------------------------------------------------
| b | b43 | dd | ff | 2 |
-----------------------------------------------------
| c | fe3 | dd | ff | 3 |
-----------------------------------------------------
| d | fd2 | gg | hh | 1 |
-----------------------------------------------------
| e | sf2 | gg | hh | 1 |
-----------------------------------------------------
| f | vd2 | ii | jj | 3 |
-----------------------------------------------------
| g | cd3 | ii | jj | 3 |
-----------------------------------------------------
I need to process to table in batches to select some of the rows.
i.e
first consider the rows with col3 =dd and col4=ff and select only one row (i have a algorithm to select this row) then consider the rows with col3=gg and col4=hh and select onse then consider the rows with col3=ii and col4=jj and select one row.
How can i iterate through my temp table to select subset of row and process .??
i need to get one row from each subset (subset with same col3 and col4) based on status Column.
Expected Result:-
| col1 | col2 | col3 | col4 | status|
-----------------------------------------------------
| b | b43 | dd | ff | 2 |
-----------------------------------------------------
| d | fd2 | gg | hh | 1 |
-----------------------------------------------------
| f | vd2 | ii | jj | 3 |
-----------------------------------------------------