我想使用连接三个表QueryBuilder.join
and QueryBuilder.joinor
但我想在 where 子句中添加括号,如下所示:
WHERE first_table_where AND (second_table_where OR third_table_where)
但似乎这是不可能的。
也许我错过了一些东西。任何帮助,将不胜感激。
我想那是一个文档的一部分 http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_3.html#Building-Queries你一直在寻找...
如果您想线性地执行复杂的查询,您甚至可以使用逆波兰表示法(所有事情)。有一个Where.or(int)
and Where.and(int)
对先前数量的指定子句执行操作的方法。
where.eq(Account.NAME_FIELD_NAME, "foo");
where.eq(Account.PASSWORD_FIELD_NAME, "_secret");
// this does an AND between the previous 2 clauses
// it also puts a clause back on the stack
where.and(2);
where.eq(Account.NAME_FIELD_NAME, "bar"),
where.eq(Account.PASSWORD_FIELD_NAME, "qwerty")));
// this does an AND between the previous 2 clauses
// it also puts a clause back on the stack
where.and(2);
// this does an OR between the previous 2 AND clauses
where.or(2);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)