Remove All Ads from XDA

[Q] SQLite Joins in ContentProvider

28 posts
Thanks Meter: 0
By javabiker, Junior Member on 29th March 2014, 07:10 PM
Post Reply Email Thread
I have a query involving 3 tables. There are 2 columns in the main table that contain code values in which each value has an associated description in the other 2 tables. This query is simple and works correctly if done as a raw query, but I'm using a contentprovider based query. The query looks like this:
SELECT col1, col2, col3, col4, col5, col6, col7 FROM T1, T2, T3 WHERE T1.col3value = T2.value AND T1.col4value = T3.value AND T1.col1 = some user supplied search value. For some reason I'm getting run time exceptions such as 'unknown column names' and 'ambiguous column names'. Tables T2 and T3 have exactly the same column names. I've seen solutions that resolve this by using a column map represented by a HashMap. I'm not sure how this would work and what the keys and values should be in this map.
I would appreciate some help with this, particularly a good example. Thanks.
Post Reply Subscribe to Thread

contentprovider, joins, sqlite3

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes