问题:出现的原因是 groupby后接的变量是一个字符串String类型,$selectRow变量中有.号,groupby会认为这是拼接两个字符串的符号,导致拼接成sql查询时,以.为分隔符 出现类似这样的情况
select delivery.customers_name,delivery.project_name,SUM(product_cube) as product_cube from `delivery` inner join `mixing_plant` on `mixing_plant`.`id` = `delivery`.`mixing_plant_id` inner join `ipc` on `ipc`.`ipc_id` = `delivery`.`ipc_id` where (`ipc_type` = 0) and 1=1 group by `delivery`.`customers_name,delivery`.`project_name`
解决办法:直接拿数组中的值
print_r($fields);
Array ( [0] => mixing_plant.short_name [1] => delivery.customers_name [2] => delivery.project_name [3] => delivery.print_concrete [4] => delivery.slump_level [5] => delivery.construction_place [6] => delivery.pouring_method [7] => delivery.ipc_id )