|Problems? Is your data what you think it is?|
return string from query (DBI, MySQL) got truncated when trying to generating statement dynamically for MySQLby khandielas (Acolyte)
|on Jul 24, 2013 at 18:26 UTC||Need Help??|
khandielas has asked for the
wisdom of the Perl Monks concerning the following question:
Hi, all, I could not find the solution for my problem.
I try to pivot several mySQL tables for reporting, the row number is not fixed so what I am doing now is that grouping it first as a subquery and then pivot it. It works fine with small number of rows but does not work with large number rows.
Here is an example, their are many cols, but only prod matters to me.
After grouping by prod, the table should be
Here is my code:
The expected output should be:
After this, I can query again to produce pivot results:
$statement is like:
It works beautifully for tables with small number of rows, but failed for tables with larger number of rows. $tmp is trucated when I have large rows. So $statement cannot be excuted successfully.
Monks, any help is highly appreciated!
Environment: Perl 5.14.2, ubuntu 12.04.2, MySQL 5.5.31