views:

103

answers:

2

I have 2 Android Databases in my app. For the sake of an example, lets say Database #1 is called JOBS and has the following columns: "Jobs Primary Key" - "Job Title" - "Job Description"

Database #2 is called PEOPLE and has the following columns: "People Primary Key" - "First Name" - "Last Name" - "Jobs ID Key"

(Yes I know these are not the greatest of designs from a database perspective, this is just to help paint a picture for my question).

Within a ListView, I'd like to display columns "First Name" - "Last Name" - "Job Title" (1 column from Database #1, 2 columns from Database #2). Using a SimpleCursorAdapter, is it possible to somehow accomplish this?

If I don't use a SimpleCursorAdapter, the only way that I can think to accomplish this is to use an ArrayAdapter, where I use a StringBuilder to concatenate the 3 columns together, and fill the ListView, but I'm wondering if there is a better way to accomplish this.

A: 
Christopher
Thanks a lot Christopher, I'll have to give that a try tonight. I'll let you know how it turns out.
Michael
Thanks guys, this did the trick, using LEFT OUTER JOIN. I apologize for the lateness of accepting the answer, I did not get the opportunity to test right away. Thanks Again!
Michael
A: 

I can't seem to comment, but you'll want to use LEFT OUTER JOIN instead of JOIN (in Christopher's answer) if you want people without jobs to show up too.

aschmack
Ah, I did think about that then got lazy. Thanks, I've added it to my answer :)
Christopher