Duplicate rows from distinct query

This query returns duplicate rows. Are there any things on the surface of this query that points to what the problem is?
export async function getAllDynamicPrompts(limit: number = 10) {
const res = await db
.selectDistinct()
.from(dynamicPrompts)
.leftJoin(dynamicPromptTags, eq(dynamicPrompts.id, dynamicPromptTags.promptId))
.leftJoin(tags, eq(dynamicPromptTags.tagId, tags.id))
.limit(limit)

return res
}
export async function getAllDynamicPrompts(limit: number = 10) {
const res = await db
.selectDistinct()
.from(dynamicPrompts)
.leftJoin(dynamicPromptTags, eq(dynamicPrompts.id, dynamicPromptTags.promptId))
.leftJoin(tags, eq(dynamicPromptTags.tagId, tags.id))
.limit(limit)

return res
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server