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

Join时需要调用函数,如何写??? #260

Open
mrcaobin opened this issue Jun 28, 2021 · 2 comments
Open

Join时需要调用函数,如何写??? #260

mrcaobin opened this issue Jun 28, 2021 · 2 comments
Labels
Enhancement 增强 增强功能、提高性能等

Comments

@mrcaobin
Copy link

有两张表 A ,B
函数func(col1,col2)返回布尔类型

select t1.* from A t1 left join B t2 on func(t1.col1,t2.col2)=true

请问这种怎么写?

@TommyLemon
Copy link
Collaborator

TommyLemon commented Aug 30, 2021

目前不支持,自己加个接口实现。
当然这个需求其实可以把条件放到 WHERE/HAVING 中

可以提个新增该功能的建议
#37

@TommyLemon TommyLemon added the Enhancement 增强 增强功能、提高性能等 label Oct 14, 2021
@TommyLemon
Copy link
Collaborator

TommyLemon commented Mar 15, 2022

现在好像可以通过 JOIN 指定条件 + @raw 实现,因为 ON 上已经支持复杂条件,我后面再看看
image

如果 func 是指 json_contains,那现在已经可以了

"col1<>@":"/T2/col2" // ON json_contains(T1.col1, cast(T2.col2 AS CHAR))

"col1{}@":"/T2/col2" // ON json_contains(T2.col2, cast(T1.col1 AS CHAR))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 增强 增强功能、提高性能等
Projects
None yet
Development

No branches or pull requests

2 participants