2016-11-27 47 views
-1

我认为,我得到了有趣的sqlite行为。我有一些表中有记录,其中某些字段值与其他字段名称相同。如果我试图通过值来查找这条记录,sqlite将它转换为字段名并执行完全不同的查询。有一些方法可以告诉sqlite,而不是某些表达式应该用作字段值,而不是指向字段名称? 示例代码说明这种情况:sqlite强制定义语句为字段值,而不是字段名称

create table Example(column1 text, column2 text, column3 text); 
INSERT INTO "Example" VALUES ("test1","column1","I want this row, where column2 has value column1"); 
INSERT INTO "Example" VALUES ("aaa","aaa","But I got this one - where column1 is equal to column2"); 

select * from Example where column1= "column2"; 

回答

0

那么,解决方案是使用“代替“,如果我使用” SQLite不投语句字段名

相关问题