QSurvey survey = new QSurvey("survey");
QEmployee emp1 = new QEmployee("emp1");
QEmployee emp2 = new QEmployee("emp2");
SQLInsertClause insert = insert(survey);
insert.columns(survey.id, survey.name);
insert.select(new SQLSubQuery().from(survey)
.innerJoin(emp1)
.on(survey.id.eq(emp1.id))
.innerJoin(emp2)
.on(emp1.superiorId.eq(emp2.superiorId), emp1.firstname.eq(emp2.firstname))
.list(survey.id, emp2.firstname));