kysely-org / kysely

A type-safe typescript SQL query builder
https://kysely.dev
MIT License
9.82k stars 250 forks source link

Improvement of lateral support #983

Closed Bessonov closed 2 months ago

Bessonov commented 2 months ago

Thank you again for the amazing query builder! It would be nice if the following query were supported:

-- mysql
select *
from customer c,
lateral (select 6371 * distance_formula) as distance
where longitude is not null;

This means:

Currently, I am using the following workaround. Please also pay attention to sql`dual` as any to overcome typings.

.innerJoinLateral(({ selectFrom, val, ref }) =>
    selectFrom(sql`dual` as any)
        .select(sql`(6371 * distance_formula)`.as('distance'))
        .as('distance'),
    join => join.onTrue()
)
Bessonov commented 2 months ago

Dear @koskimas,

I am not sure how to interpret the closure of this issue. I don't see any changes related to it nor a wontfix label. Could you please provide a few words of clarification?

Thank you!

Bessonov commented 1 month ago

@koskimas a friendly reminder 🥞