I’ve created a view in my SQLite database, it contains two _id columns and some other info created by this statement:
CREATE VIEW IF NOT EXISTS journeyProfileContactsView AS SELECT JourneyProfile._id, JourneyProfile.TITLE, ContactsProfiles._id, ContactsProfiles.NAME, ContactsProfiles.NUMBER FROM ProfileToContacts INNER JOIN JourneyProfile ON ContactsProfiles._id=ProfileToContacts.contactID INNER JOIN ContactsProfiles ON JourneyProfile._id=ProfileToContacts.profileID
and have been struggling with this error for some time:
11-27 19:30:04.686: E/AndroidRuntime(12946): Caused by: android.database.sqlite.SQLiteException: no such column: _id: , while compiling: SELECT * FROM journeyProfileContactsView WHERE _id=1
I am sure that the column does exist, I’ve opened up the view in SQLite Manager and can confirm that the column exists as _id (the other column is _id:1), although inspecting the cursor suggests it may actually be JourneyProfile._id.
I’ve tried:
"JourneyProfile._id=" + id
"_id=" + id
Its really stumped me and I’m not sure where I am going wrong. Any help?
The problem was with using an old view. I forced my view to be re-created as the table structure had changed and this has resolved it.