I have created two views in sqlite – android , but when i create the second view
i am getting error for
No Such Coulmn : template_contact_info.tmp_text as text and
template_contact_info.tmp_link as link
even though both these columns are present in template_contact_info and template_contact_view has been created successfully. but still dont know why i am getting No such column error.
Here is the code of views
First View
db.execSQL("CREATE VIEW IF NOT EXISTS
template_contact_info AS
SELECT
template_info.tmp_text as tmp_text ,
template_info.tmp_link as tmp_link ,
template_info.tmp_id as temp_id ,
template_info.tmp_type as tmp_type ,
template_contact._id as _id
from template_info , template_contact
where template_info.tmp_id = template_contact.tmp_id");
Second View // here i am getting an error
db.execSQL("CREATE VIEW IF NOT EXISTS
template_contact_assign AS SELECT
contact_info.c_number as number ,
contact_info.c_name as name ,
contact_info.c_id as conid,
contact_info._id as cid,
template_contact_info.tmp_type as type ,
template_contact_info.temp_id as tempid ,
template_contact_info.tmp_text as text ,
template_contact_info.tmp_link as link
FROM contact_info LEFT JOIN template_contact_info
ON contact_info._id = template_contact_info._id");
//you are tying to get
//while creating you are using
temp_idinstead oftmp_idEdit:
DB is already exists so you need to uninstall/remove the database to create again for modified table.
Remove the database either by command utility ‘adb shell
or via eclipse using the file explorer. The database resides in under‘/data/data//databases’`.For
adb use rm <db_name>