同一表中columnA等于columnB的Ebean [英] Ebeans where columnA equals columnB in same table
问题描述
我有一个表,其中有两列Long类型的表。在我的查询中,我想返回A列(长型)等于B列(长型)的行。
我想不编写原始sql来执行此操作,而是使用更好的方法链接。
I have a table that, amongst other things, has two columns of type Long. In my query, i want to return rows where column A (type long) equals column B (type long). I would like to do this without writing raw sql, and instead use the much nicer method chaining.
到目前为止,我一直具有比较的价值我可以传递给的列,例如
So far i've always had a value to compare the column against, which i can pass in, such as
.eq("columnA", 5L)
但是,我似乎找不到类似的方法
However, I can't seem to find any method for something like
.eq("columnA", "columnB")
<我觉得这应该是一种相当标准的搜索方式(至少并非罕见)。
I feel like this should be a fairly standard kind of search to do (at least not rare). Does anyone out there know how I could do this?
推荐答案
.raw( columnA = columnB)应该可以。
.raw("columnA = columnB") should work.
这篇关于同一表中columnA等于columnB的Ebean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!