select *
from WeeklyChallengeCourses
where weekly_challenge_id = (select weekly_challenge_id
from WeeklyChallengeCourses
where course_id = 210);
Result will be the below selected one:
const data = await context.prisma.weeklyChallengeCourses.findMany({
where:{
weekly_challenge_id: {
..............
}
},
});
In Prisma, you would have to use two different queries to solve this:
weekly_challenge_id
findMany
with the weekly_challenge_id
found in step 1.// I'm assuming course_id is unique.
const course = await context.prisma.findUnique({ where: { course_id: 210 } });
const data = await context.prisma.weeklyChallengeCourses.findMany({
where:{
weekly_challenge_id: course.weekly_challenge_id
},
});
Alternatively, you could use the rawQuery
feature to run the SQL directly and do it in one query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With