php拼接字符串
$str="selectsum(nvl(month_1,0))asM1,sum(nvl(month_2,0))asM2,sum(nvl(month_3,0))asM3,s...
$str = "select sum(nvl(month_1,0)) as M1,sum(nvl(month_2,0)) as M2,sum(nvl(month_3,0)) as M3,sum(nvl(month_4,0)) as M4,sum(nvl(month_5,0)) as M5,sum(nvl(month_6,0)) as M6,
sum(nvl(month_7,0)) as M7,sum(nvl(month_8,0)) as M8,sum(nvl(month_9,0)) as M9,sum(nvl(month_10,0)) as M10,sum(nvl(month_11,0)) as M11,sum(nvl(month_12,0)) as M12,
sum(nvl(meter_total,0)) as total
from ".$y_table." a,".$device_info." b where a.year = '".$valuey."' and a.meter_id = b.meter_id and b.purpose != '007'";
if($priv_role->check('catid', $campusid, 'view', 0, false, 'E')){
if(!isset($campusid)){
showmessage("error: campusid is null",'?file=electricline&action=all');
}else{
str+="and b.MANUFACTURER_CODE = "'.$campusid.';
}
}
str+=怎么加标点sql语句可以执行? 展开
sum(nvl(month_7,0)) as M7,sum(nvl(month_8,0)) as M8,sum(nvl(month_9,0)) as M9,sum(nvl(month_10,0)) as M10,sum(nvl(month_11,0)) as M11,sum(nvl(month_12,0)) as M12,
sum(nvl(meter_total,0)) as total
from ".$y_table." a,".$device_info." b where a.year = '".$valuey."' and a.meter_id = b.meter_id and b.purpose != '007'";
if($priv_role->check('catid', $campusid, 'view', 0, false, 'E')){
if(!isset($campusid)){
showmessage("error: campusid is null",'?file=electricline&action=all');
}else{
str+="and b.MANUFACTURER_CODE = "'.$campusid.';
}
}
str+=怎么加标点sql语句可以执行? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询