gpt4 book ai didi

Sqlite 查询 - 测试数据库设定区域中是否存在多个值

转载 作者:行者123 更新时间:2023-12-02 07:30:59 24 4
gpt4 key购买 nike

我正在尝试搜索包含书籍、章节、诗句、内容的圣经表。我希望看到的是,某一章是否包含一组搜索术语的全部,并返回这些术语至少存在一次的书籍和章节。

我已经尝试过:

select book, chapter, content from bible 
where content like '%Joseph%' AND content like '%prison%'
Group by book, chapter

这会返回给定诗句的匹配项,但即使一个单词位于第 1 节中,另一个单词位于同一本书/章节的第 N 节中,我也想匹配。

最佳答案

您可以使用基于聚合的条件:

select book, chapter
from bible
Group by book, chapter
having count(case when content like '%Joseph%' then 1 end) > 0
AND count(case when content like '%prison%' then 1 end) > 0;

关于Sqlite 查询 - 测试数据库设定区域中是否存在多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42073690/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com