Skip to content Skip to sidebar Skip to footer

SQLite, Tables, Joining

Android, implementing SQLite These are the tables i have: http://postimg.org/image/jafsx39h7/ I have the code: public String getWorkoutNameInfo() { // TODO Auto-generated metho

Solution 1:

When I enter your data into a SQLite instance on my machine and then execute your query, I get the following error:

Error: ambiguous column name: workout_id

In the query, changing WHERE workout_id to WHERE DateofWorkout.workout_id makes the error go away.

This problem happens because there are two columns named workout_id in the result, and you must disambiguate your subsequent references. Because of this, you probably must also change

c.getColumnIndex(KEY_WORKOUT_NAME)

to

c.getColumnIndex(TABLE_DATE_WORKOUT + "." + KEY_WORKOUT_NAME)

when you make use of the results later.


Post a Comment for "SQLite, Tables, Joining"