$sth = $dbh->prepare("select CODE_ID,NAME_CODE,SUM(INR_COL + OUT_COL) AS "TOTAL SUM" from nwsa where CODE_ID='L01A' OR CODE_ID='L01B'OR CODE_ID='L01C' OR CODE_ID='L01D' OR CODE_ID='L01DA' OR CODE_ID='L01E' OR CODE_ID='L02A' OR CODE_ID='L02B' OR CODE_ID='L02C' OR CODE_ID='L02E' OR CODE_ID='L02N' group by CODE_ID,NAME_CODE "); # your query here
$sth->execute( );
$out = DBIx::Dump->new('format' => csv, # excel or csv
'output' => $FILENAME, # file to save as
'sth' => $sth);
错误来自" TOTAL SUM" .. 什么是错误..?
答案 0 :(得分:3)
转义引号:
$sth = $dbh->prepare("select CODE_ID,NAME_CODE,SUM(INR_COL + OUT_COL) AS \"TOTAL SUM\" ........
或使用单引号:
$sth = $dbh->prepare('select CODE_ID,NAME_CODE,SUM(INR_COL + OUT_COL) AS "TOTAL SUM" ........');