in reply to compare current row with previous row
Some issues, however:use Data::Dumper; my $prev_data; while (my $data = $sth->fetchrow_arrayref()) { if( $prev_data && $data->[0] == $prev_data->[0] && $data->[1] == $prev_data->[1] && $data->[2] == $prev_data->[2] ){ print $data->[4]; }else{ print Dumper $data; } $prev_data = $data; }
Update: I just noticed the note "I have no control over the select statement that is issued" .. why not? Is the prepare statement you listed not representative of your actual code?SELECT t.col0, t.col1, t.col2, t.col4 FROM mytable as t JOIN ( SELECT col0, col1, col2, min(col4) FROM mytable GROUP BY col0, col1, col2 HAVING COUNT(*) > 1 ) as tmp ON tmp.col0 = t.col0 AND tmp.col1 = t.col1 AND tmp.col2 = t.col2 AND tmp.col4 <> t.col4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: compare current row with previous row
by Anonymous Monk on Jan 16, 2006 at 15:06 UTC |