Sqlite FTS:跨两列执行 AND
Sqlite FTS: Performing AND across two columns
我需要执行一个查询来匹配不同列中的两个不同术语。例如:
select * from messages where messagefts match "categories:Office AND subject:Hi there";
从我的角度来看,这应该可行,因为我的记录应该具有包含该特定主题的 Office 类别。该查询使用 OR 而不是 AND 工作,但是当我尝试使用 AND 时我没有得到任何结果。
知道为什么会这样吗?
您需要使用隐含的 AND
:
select * from messages
where messagefts
match "categories:Office subject:Hi there";
我需要执行一个查询来匹配不同列中的两个不同术语。例如:
select * from messages where messagefts match "categories:Office AND subject:Hi there";
从我的角度来看,这应该可行,因为我的记录应该具有包含该特定主题的 Office 类别。该查询使用 OR 而不是 AND 工作,但是当我尝试使用 AND 时我没有得到任何结果。
知道为什么会这样吗?
您需要使用隐含的 AND
:
select * from messages
where messagefts
match "categories:Office subject:Hi there";