select car.carton_no,car.carton_weight,car.update_time, nvl(count(box.packing_box_sys_id), 0) PACKED_BOX_NUM
from PACKING_BOX box, PACKING_CARTON car
where box.PACKING_CARTON_SYS_ID = car.PACKING_CARTON_SYS_ID
and car.CARTON_NO = 'CN0GH911708218CF02P7'
and box.STATUS = '1' 注 : 按理说上面的语句查出来应该只有一条数据现在报了这个异常 实在苦于经验不足 请大侠们指点下。异常消息: ORA-00937: not a single-group group function
from PACKING_BOX box, PACKING_CARTON car
where box.PACKING_CARTON_SYS_ID = car.PACKING_CARTON_SYS_ID
and car.CARTON_NO = 'CN0GH911708218CF02P7'
and box.STATUS = '1'
group by car.carton_no,car.carton_weight,car.update_time;详细解释看 : ORA-00937: not a single-group group function