加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

SQLite where子句在TEXT字段中表现异常

发布时间:2020-12-12 18:53:24 所属栏目:百科 来源:网络整理
导读:我在sqlite.org上搜索过,无法想出这个.我已经习惯了 MySQL,所以我想也许我会忽略一些东西. 请参阅以下代码: sqlite select id,event_number,must_say from events where id=28;28|'28'|'AFK'sqlite select id,must_say from events where must_say='AFK';sq
我在sqlite.org上搜索过,无法想出这个.我已经习惯了 MySQL,所以我想也许我会忽略一些东西.

请参阅以下代码:

sqlite> select id,event_number,must_say from events where id=28;
28|'28'|'AFK'
sqlite> select id,must_say from events where must_say='AFK';
sqlite> select id,must_say from events where must_say like 'AFK';
sqlite> select id,must_say from events where must_say like 'A%';
sqlite> select id,must_say from events where must_say=='AFK';
sqlite>

不用说,我真的希望所有上述查询都返回以下内容,而不仅仅是第一个:

28|'28'|'AFK'

我在所有TEXT字段上都有这种行为.好像我根本无法搜索.

这是我的事件表的模式,省略了不相关的字段:

CREATE TABLE events (
    id INTEGER PRIMARY KEY AUTOINCREMENT,EVENT_NUMBER INTEGER,MUST_SAY TEXT
);

有任何想法吗?我只是希望能够通过表格中的任意文本字段进行搜索.

编辑:我正在使用SQLite3.

解决方法

您的列中也可能有空格.

你可以看到空格

select '|' || must_say || '|' from events

你可以看到unprintables

select hex(must_say) from events

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读