sqlite 为什么 select like 有效而 equals 不行?

编程入门 行业动态 更新时间:2024-10-28 11:25:45
本文介绍了sqlite 为什么 select like 有效而 equals 不行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的 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 不行?

本文发布于:2023-10-16 22:09:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1498865.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:sqlite   select   equals

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!