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
}
Was this page helpful?