三个表上的 Ormlite 内连接
我想在三个表上创建一个内部联接,例如:
SELECT C.Description, D.ItemDescription
FROM OrderDetailStatement AS D
INNER JOIN OrderHeaderStatement AS H
ON H.OrderHeaderStatementRefID = D.OrderHeaderStatementRefID
INNER JOIN customers AS C
ON H.CustomerRefID = C.CustomerRefID
WHERE (D.MixedValue > 1000)
但我有点困惑,你能给我一个演练吗?
提前致谢
i want to create an inner join on three tables like this one for example:
SELECT C.Description, D.ItemDescription
FROM OrderDetailStatement AS D
INNER JOIN OrderHeaderStatement AS H
ON H.OrderHeaderStatementRefID = D.OrderHeaderStatementRefID
INNER JOIN customers AS C
ON H.CustomerRefID = C.CustomerRefID
WHERE (D.MixedValue > 1000)
but i'm a little bit confused, could you please provide me a walkthrough?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ORMLite 现在支持简单的
JOIN
声明。您可以执行如下操作:但是请注意,您只能使用此机制从查询生成器获取实体。如果您想从不同的对象获取两个描述字段,那么您仍然必须使用原始查询。
支持“原始查询”,包括
Dao.queryRaw()
方法,您可以在其中使用自己的 SQL。我怀疑你已经找到它们了。以下是原始查询文档。ORMLite now supports simple
JOIN
statements. You can do something like the following:Notice, however, that you can only get entities from the query builder using this mechanism. If you want to get your two description fields from different objects then you would have to still use a raw-query.
There is support for "raw queries" including the
Dao.queryRaw()
method where you can use your own SQL. I suspect you've found them already. Here are the docs for raw queries.