in reply to Help with more efficient data translation from DB query
select m, p from ... where u = N group by m, p order by m, p;
my( $m, $p ); $cursor->bind_col( 1, \$m ); $cursor->bind_col( 2, \$p, { type => SQL_INTEGER } ); my @data; while( $cursor->fetch() ) { if( @data && $m == $data[-1][0] ) { push @{ $data[-1][1] }, 0+$p; } else { push @data, [ $m, [0+$p] ]; } }
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with more efficient data translation from DB query (order++)
by mje (Curate) on Oct 15, 2009 at 08:35 UTC |