SQL 语句:
SELECT patient_id,
patient_name,
other_patient_id,
other_patient_name,
english_patient_name,
patient_id_issuer,
patient_sex,
patient_birth_date,
patient_birth_time,
count(*) as study_count,
sum(series_count) as series_count,
sum(instance_count) as instance_count,
NULL
FROM sv_study_patient_id s
WHERE merge_key IS NULL
AND hide_code IS NULL
AND instance_count > 0
AND rownum < 1000
GROUP BY patient_id,
patient_id_issuer,
patient_name,
other_patient_id,
other_patient_name,
english_patient_name,
patient_sex,
patient_birth_dttm,
merge_key,
hide_code
在 11.2.0.3 下报 ORA-00979 错误,
http://ww3.sinaimg.cn/large/42ae781fgw1ez2hfuc8c0j21kw0wmqk4.jpg
可在 11.1.0.6 下却可以执行成功
http://ww3.sinaimg.cn/large/42ae781fgw1ez2he6ruu2j20wz0kitfv.jpg
请解
1
mringg 2015-12-17 11:33:39 +08:00 via Android 1
语句貌似就有问题, select 非聚集的列必须用 group by 分组
|
2
mringg 2015-12-17 11:34:34 +08:00 via Android
还有个不是问题的问题,能不能 select 和 group by 后面的列顺序保持一直
|