Ebeans where columnA equals columnB in same table

故事扮演 提交于 2020-01-04 13:48:05

问题


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?


回答1:


.raw("columnA = columnB") should work.



来源:https://stackoverflow.com/questions/25319922/ebeans-where-columna-equals-columnb-in-same-table

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