我的 sqlite3 数据库有问题,我执行以下查询
I have a problem with sqlite3 database, I execute the following queries
sqlite> select * from property where link like"www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/";
sqlite> select * from property where link like "www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/";
我得到两行
17|2014-11-03|Meester Spoermekerlaan88|www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/|5237JZ|Den Bosch|€789|3|1
17|2014-11-03|Meester Spoermekerlaan 88|www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/|5237 JZ|Den Bosch|€ 789|3|1
32|2014-11-03|Meester Spoermekerlaan88|www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/|5237JZ|Den Bosch|€789|3|1
32|2014-11-03|Meester Spoermekerlaan 88|www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/|5237 JZ|Den Bosch|€ 789|3|1
然后我执行相同的查询,但使用相等运算符,就像这样
Then I execute the same query, but using the equality operator, like so
sqlite> select * from property wherelink="www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/";
sqlite> select * from property where link="www.domain/huur/den-bosch/appartement-48118689-meester-spoermekerlaan-88/";
sqlite> (<---- 没有结果??)
sqlite> (<---- no results??)
我已经找到了与我类似的答案,但是问题不一样,我的字段是数据类型文本",正如您在此处看到的:stackoverflow/a/14823565/279147
I already found a similar answer to mine, however the issue is not the same, my fields are of datatype "text", as you can see here: stackoverflow/a/14823565/279147
sqlite> .schema 属性
sqlite> .schema property
CREATE TABLE 属性(id 整数 PRIMARY KEY AUTOINCREMENT UNIQUE、日期"文本、地址文本、链接文本、邮政编码文本、城市文本、价格文本、房间文本、页面整数);
CREATE TABLE property (id integer PRIMARY KEY AUTOINCREMENT UNIQUE,"date" text,address text,link text,postcode text,city text,price text,rooms text,page integer);
那么有人知道为什么会发生这种情况吗?这是我的版本信息
So does anybody have any idea why this would happen? here is my version information
root@s1:/# sqlite3 application.sqlite3
root@s1:/# sqlite3 application.sqlite3
SQLite 3.7.3 版
SQLite version 3.7.3
推荐答案我遇到了同样的问题.这项工作对我有用.
I had the same problem. This work around worked for me.
SELECT * from foo WHERE CAST(name AS BLOB) = CAST('bla' AS BLOB);
SELECT * from foo WHERE CAST(name AS BLOB) = CAST('bla' AS BLOB);
更多推荐
sqlite 为什么 select like 有效而 equals 不行?
发布评论