인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

No author

This post's author information has been deleted.

Practice! Querydsl

서브쿼리 안에 groupby시 sequence number not allowed here

Written on

·

352

0

안녕하세요

oracle db에서 서브쿼리 안에서 groupby를 했을떄 ORA-02287 sequence number not allowed here 오류가 나옵니다. 검색해보니

SEQUENCE를 사용할 수 없는 경우는 다음과 같다.

SELECT 문장의 경우에서

1. WHERE 절 안에서
2. GROUP BY나 ORDER BY 절에서
3. DISTINCT 절에서
4. UNION 이나 INTERSECT 나 MINUS 와 함께 사용 할때
5. 서브 쿼리 안에서

라고 하는데 제 경우에는 이 group by를 하고싶으면 어떻게 할수있나요?

감사합니다.

Integer sucessCount =0, 

JPQLQuery<Tuple> subQuery = JPAExpressions.select(
log.name,
log.content,
new CaseBuilder()
   .when(log.statusCode.eq("0")
   .then(sucessCount+1)
   .otherwise(successCount),
client.id
)
.from(log)
.leftJoin(client)
.on(client.name.eq(log.name))
//이 group by가 문제
.groupBy(log.name, log.content, client.id);

queryFactory.insert(stats)
.columns(
   stats.name,
   stats.content,
   stats.successCount,
   stats.clientId
)
.select(subQuery)
.execute();
javajpa

Answer 1

0

yh님의 프로필 이미지
yh
Instructor

안녕하세요. Brian님

다음을 참고해주세요.

https://www.inflearn.com/questions/34751

감사합니다.

No author

This post's author information has been deleted.

Ask a question