У меня есть поле в главном разделе SELECT, по которому я хочу сгруппировать в своем отчете.
CAST((SELECT attribute_value.attrib_value_name
FROM attribute_value,
attribute_type
WHERE attribute_type.attrib_type_code = 'SC17'
AND attribute_type.attrib_type_code = attribute_value.attrib_type_code
AND attribute_value.attrib_value_code = feat_attrib_type.attrib_value_code ) as VARCHAR (30)) as ZONE_SPEC,
Я попытался поместить тот же код в раздел группы SQL, но это продолжает возвращаться с сообщением об ошибке
"ORA-00933: SQL команда не завершена должным образом"
Код, который я получил до сих пор:
select
CAST((SELECT attribute_value.attrib_value_name
FROM attribute_value,
attribute_type
WHERE attribute_type.attrib_type_code = 'SC17'
AND attribute_type.attrib_type_code = attribute_value.attrib_type_code
AND attribute_value.attrib_value_code = feat_attrib_type.attrib_value_code ) as VARCHAR (30)) as ZONE_SPEC,
feature_type.feature_type_name,
sum (feat_measurement.feature_quantity)
from
feature
inner join feature_type on feature.feature_type_code = feature_type.feature_type_code
inner join area on feature.area_code = area.area_code
inner join feat_measurement on feature.plot_number = feat_measurement.plot_number
and feature.site_code = feat_measurement.site_code
inner join measurement_type on feat_measurement.measurement_code = measurement_type.measurement_code
inner join feat_attrib_type on feature.site_code = feat_attrib_type.site_code AND
feature.plot_number = feat_attrib_type.plot_number
where
measurement_type.measurement_code in ('AREA') and
feature.feature_deadflag = 'N'
group by
CAST((SELECT attribute_value.attrib_value_name
FROM attribute_value,
attribute_type
WHERE attribute_type.attrib_type_code = 'SC17'
AND attribute_type.attrib_type_code = attribute_value.attrib_type_code
AND attribute_value.attrib_value_code = feat_attrib_type.attrib_value_code ) as VARCHAR (30)) as ZONE_SPEC,
feature_type.feature_type_name
order by
feature_type.feature_type_name
Можно ли добавить это поле CAST в группу по полю? И если да, то как?