1、单独执行下列语句OK
select c,min(oper_id) c_id
from tt
group by c
2、加上子查询:
select c,(select name from users where user_id=c_id)
from
(
select c,min(oper_id) c_id
from tt
group by c
) ss
执行报告ORA-00979 不是GROUP BY表达式3、加上关联dual就OK
select c,(select user_name from users where user_id=u_id)
from
(
select c,min(oper_id) u_id
from tt
group by c
) ss,dual奇怪吧??
select c,min(oper_id) c_id
from tt
group by c
2、加上子查询:
select c,(select name from users where user_id=c_id)
from
(
select c,min(oper_id) c_id
from tt
group by c
) ss
执行报告ORA-00979 不是GROUP BY表达式3、加上关联dual就OK
select c,(select user_name from users where user_id=u_id)
from
(
select c,min(oper_id) u_id
from tt
group by c
) ss,dual奇怪吧??
select c,user_name
from
(
select c,min(oper_id) c_id
from tt
group by c
) ss,users
where ss.cid=users.user_id
C, (SELECT NAME FROM USERS WHERE USER_ID = C_ID)
FROM (SELECT C, MIN(OPER_ID) C_ID FROM TT GROUP BY C) SS;