出于某种原因,我无法使此查询生效。
select substr(x.id, 4, 5)
from x
join y
on x.id=y.x_id
where 1=1
group by substr(x.id, 4, 5)
order by substr(x.id, 4, 5) asc
它一直在说: ORA-00979:不是GROUP BY表达式 00979. 00000 - "不是GROUP BY表达式"
这有效:
SELECT * FROM (
select substr(x.id, 4, 5) as col
from x
join y
on x.id=y.x_id
where 1=1
group by substr(x.id, 4, 5)
)
order by col asc
是否可以在不使用子查询的情况下执行此操作?