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

Ability to perform merge update #85

Open
reenimathew opened this issue May 17, 2019 · 2 comments
Open

Ability to perform merge update #85

reenimathew opened this issue May 17, 2019 · 2 comments

Comments

@reenimathew
Copy link

reenimathew commented May 17, 2019

Is it possible to perform update by joining with another table? I don't see such a capability.
Can someone help with this? I don't want to do sub query as I need to update multiple columns from other table.

UPDATE Products
SET end_date = other.end_date
FROM Products me
JOIN #updates other
ON (me.id = other.id)

@jeffgbutler
Copy link
Member

This syntax isn't in the library now. You could easily code this statement by hand and add it to a mapper.

@DaZuiZui
Copy link

hope i can help,my idea is to use JOIn to join other tables,and defube ub tge XML mapping file how to execute the sql statement.

<update id="debugFuction" parameterType="UrParameterType">
  UPDATE tmptable1 t1
  JOIN tmptable2 t2 ON (t1.id = t2.id)
  SET t1.testdate = t2.testdate
</update>

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

3 participants