Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Select on join and condition #857

Answered by jeffgbutler
ramadom asked this question in Q&A
Discussion options

Does Mybatis Dynamic support a sub select inside and() method as a join() condition?

SELECT ...
FROM table1 t1
JOIN table2 t2 ON t2.id = t1.id AND t2.value = (SELECT max(column) FROM table3)

How it should be defined in this case?

select(...)
.from(table1, "t1")
.join(table2, "t2").on(t2.id, equalTo(t1.id), and(t2.value, isEqualTo(select(max(column)).from(table3)))

Same and() condition seems allowed with where() clause.

You must be logged in to vote

This is supported in the 2.0.0 version. It's not released yet, but it is in the SNAPSHOT version currently.

Replies: 1 comment · 1 reply

Comment options

This is supported in the 2.0.0 version. It's not released yet, but it is in the SNAPSHOT version currently.

You must be logged in to vote
1 reply
@ramadom
Comment options

Will check v2.0.0 and wait for release. Thanks for the great tool!

Answer selected by ramadom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.