ORMLite Join Queries with Query Builder

▼魔方 西西 提交于 2020-01-06 04:29:07

问题


I'm having some issue with understanding join queries in ormlite. ormlite query builder supports 4 join methods.

1. join()
2. joinOr();
3. leftJoin();
4. leftJoinOr();

I can understand join() following picture illustrates join() method.

Please explain me other join methods using similar pictures?

(I can understand other join types in generic SQL, but when it comes to ORMLite query builder methods are different it seems)

Pictures taken from this post.


回答1:


Please explain me other join methods using similar pictures?

I've spent a lot of time on the javadocs. They should be helpful. They explain what SQL is being used and that the "Or" part is.

  1. join() is the same as a SQL INNER JOIN as stated in the javadocs. That matches your picture.

  2. joinOr() is the same as a SQL INNER JOIN but the WHERE parts of the two queries are "OR'd" together as stated in the javadocs. Same picture as #1.

  3. leftJoin() is the same as (wait for it) a SQL LEFT JOIN as stated in the javadocs. That corresponds to adding A to the area in red. See your linked post and look for LEFT JOIN.

  4. leftJoinOr() is the same as a SQL LEFT JOIN as well but the WHERE parts of the two queries are "OR'd" together as stated in the javadocs. Same picture as #3.



来源:https://stackoverflow.com/questions/23213173/ormlite-join-queries-with-query-builder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!