oracle group by 排序 出现错误
SELECT
tmp.id as carId,
tmp.lic_num as licNum,
tmp.driver_name as driverName,
tmp.param_name as regionName,
e.alarm_type as alarmType,
e.alarm_name as alarmName,
count(*) as alarmCount
from
els_device_alarm_info e,
(
SELECT c_info.id,c_info.lic_num,d.driver_name,els_param.param_name,els_d.device_id d_id
from car_info c_info,driver_info d,els_system_params els_param,els_device els_d
WHERE
els_param.param_type = 'region_code'
AND
els_param.param_value = c_info.region_code
AND
els_d.car_id = c_info.id
AND
d.driver_id = c_info.driver_id
) tmp
WHERE tmp.d_id = e.device_id
AND
e.time >= to_date('2013-12-01 10:50','yyyy-MM-dd hh24:mi')
AND
e.time <= to_date('2014-01-16 10:50','yyyy-MM-dd hh24:mi')
AND
ROWNUM < 10
GROUP BY
licNum,
alarmType;
------解决方案--------------------明显都没有alarmType这个字段,是alarm_type吧,另外也没有这个licNum吧 这个是你select的别名 怎么能group by呢
------解决方案---------