我在sqlite中创建了两个视图 - android,但是当我创建第二个视图时
我收到错误No Such Coulmn:template_contact_info.tmp_text as text and template_contact_info.tmp_link as link
即使这两列都存在于template_contact_info中,并且已成功创建template_contact_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");
第二个视图 //这里我收到错误
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");
答案 0 :(得分:3)
//你想要获得
template_contact.tmp_id
//在创建时使用temp_id
代替tmp_id
template_contact_info.temp_id
修改强>
数据库已存在,因此您需要卸载/删除数据库以再次为已修改的表创建。
通过命令实用程序'adb shell or via eclipse using the file explorer. The database resides in under
'/ data / data // databases'`删除数据库。
adb use rm <db_name>