Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Question [Q] SQLite Joins in ContentProvider

OP javabiker

29th March 2014, 07:10 PM   |  #1  
javabiker's Avatar
OP Junior Member
Flag Jacksonville
Thanks Meter: 0
 
16 posts
Join Date:Joined: Oct 2012
More
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

Tags
contentprovider, joins, sqlite3
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes