在android中使用sqlite连接表的最佳方式 [英] Best way to join tables using sqlite in android

查看:234
本文介绍了在android中使用sqlite连接表的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Android应用程序中使用sqlite数据库找出在我的两个表上做一个简单的表连接的最好的方法。

I am trying to find out the best way to do a simple table join on my two tables using a sqlite database in an android application. Is the simplest way to use CursorJoiner or is there any easier way?

推荐答案

在执行 SQLiteDatabase SQLiteQueryBuilder 您将看到可以将要加入的表传递到 table query ,即使文档暗示它只需要一个表的单个名称。 SQLiteQueryBuilder 的文档更清楚,甚至可以建议类似 foo,bar foo LEFT OUTER JOIN bar ON(foo.id = bar.foo_id)

In the implementation of SQLiteDatabase and SQLiteQueryBuilder you will see that it is possible to pass the tables you want to join to the table argument of query even though the documentation implies it will only take a single name of a table. The documentation for SQLiteQueryBuilder is more clear and even suggests things like foo, bar or foo LEFT OUTER JOIN bar ON (foo.id = bar.foo_id).

这篇关于在android中使用sqlite连接表的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆