#!perl use strict; use DBI; my $dbh = connect(...); $dbh->do('SET SESSION group_concat_max_len = 2048');; my $pvt_col = 'prod'; my $count = 'count'; my $table = 'prod_test'; #test data create_test_db($ARGV[0] || 10); my $s1 =<selectrow_array($sql1); my $sql2 = <selectrow_array($sql2); print "@f\n"; sub create_test_db { my $no = shift; #$dbh->do("DROP TABLE $table"); $dbh->do("CREATE TABLE IF NOT EXISTS $table ( id int(11) NOT NULL AUTO_INCREMENT, $pvt_col varchar(20) NOT NULL, PRIMARY KEY (id))"); $dbh->do("DELETE FROM $table"); for my $n (1..$no){ for (1..$n){ $dbh->do("INSERT INTO $table VALUES (?,?)",undef,undef,sprintf "prod%02d",$n); } } }