Roadblock
Roadblock

Reputation: 2071

Queries in Content Provider

Is it possible to use advanced SQL queries involving inner join/outer Join in Content Providers? How is this done? My other question: Is it necessary to create a new Database inside Content Providers? Can we use an already existing DB?

Upvotes: 0

Views: 123

Answers (1)

kevingoos
kevingoos

Reputation: 4353

Yes you can do an inner join/outer join in a content provider. Like this:

String tables = "table1 LEFT OUTER JOIN table2 ON (table1.sportId = table2._id)";
queryBuilder.setTables(tables);

And don't need to make a new instance you can just pass it through in the constructor if you want. Or make from you database class an Singleton.

Upvotes: 1

Related Questions