'how to insert subQuery at join by "QueryDLS"

I'm using QueryDLS. But I got some problems.

My Database server is MariaDB.

select s.* , a.user_id 
from schedule s 
left outer join(
    select sch_idx, group_concat(user_id SEPARATOR ',') as user_id 
    from attendee a 
    group by sch_idx
) a 
on s.idx = a.sch_idx; 

and this is my code( Ofcoursly, It' is wrong)

public void selectJoin(){
    JPAQueryFactory query =  new JPAQueryFactory(em);

    QSchedule qSchedule = QSchedule.schedule;
    QAttendee qAttendee = QAttendee.attendee;

            query.selectFrom(qSchedule)
            .leftJoin(
                    query.select(
                            qAttendee.schIdx,
                            qAttendee.userId
                    ).from(qAttendee)
                    .groupBy(qAttendee.schIdx)
            ).on(qSchedule.idx.eq(qAttendee.schIdx))
            .fetch();
}

How can I insert subquery in the join like my sql sample? And I Have to resolve Group_concat in QueryDSL

If I can not resolve my truoble by QueryDSL, Let me know what is best solutions.

please, I need your help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source