Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement of lateral support #1131

Closed
Bessonov opened this issue Aug 26, 2024 · 1 comment
Closed

Improvement of lateral support #1131

Bessonov opened this issue Aug 26, 2024 · 1 comment

Comments

@Bessonov
Copy link

#983 was closed without any comment mistakenly.

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:

  • Supporting fromLateral.
  • Supporting selectNoFrom in laterals.

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
Copy link
Author

Hey @koskimas , any comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants