Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 从数据库中选择一系列诗句_Sql_Ms Access_Vbscript_Asp Classic - Fatal编程技术网

Sql 从数据库中选择一系列诗句

Sql 从数据库中选择一系列诗句,sql,ms-access,vbscript,asp-classic,Sql,Ms Access,Vbscript,Asp Classic,我有一个数据库,里面有圣经中的经文,还有这些字段: 书(书号)、章(章号)、诗(诗号)、文(诗节) 例:1起初,上帝创造了天地。 第一个1代表创世记,第二个1代表第一章,第三个1代表第一节 用户给了我类似于11:1-11:4的东西,这意味着他想展示创世记1:1-4 我想做的是从圣经中选择(book*1000000+chapter*1000+韵文作为索引),其中索引>=1001001,索引=1001001,book*1000000+chapter*1000+韵文这是有效的: 从圣经中选择文本,其中

我有一个数据库,里面有圣经中的经文,还有这些字段: 书(书号)、章(章号)、诗(诗号)、文(诗节)

例:1起初,上帝创造了天地。
第一个1代表创世记,第二个1代表第一章,第三个1代表第一节

用户给了我类似于11:1-11:4的东西,这意味着他想展示创世记1:1-4

我想做的是从圣经中选择(book*1000000+chapter*1000+韵文作为索引),其中索引>=1001001,索引=1001001,book*1000000+chapter*1000+韵文这是有效的:
从圣经中选择文本,其中book*1000000+chapter*1000+verse>=“&FROM&”和book*1000000+chapter*1000+verse我建议使用单列“索引”,但不是每次为查询计算索引(执行速度慢1000倍),而是使用公式“book*1000000+chapter*1000+verse”一次性填充

假设您在表单中有控件来选择书籍、章节和诗句,包括开始和结束。然后,您可以将过滤器构建为

SELECT index, verse
FROM bible
WHERE index >=
    Forms!f!startBook * 1000000 + Forms!f!startChapter + 1000 + Forms!f!startVerse
AND index <=
    Forms!f!endBook * 1000000 + Forms!f!endChapter + 1000 + Forms!f!Verse

你可能想考虑为这本书花几百万,为诗篇保留3个数字,有超过100章。你的问题是什么?上面的sql有什么不可用的吗?我正在用ASP/VBscript使用它。我想保持我的数据库最小。。因此,我更喜欢为页面添加1ms来加载,而不是在数据库中添加冗余数据。非常感谢。
SELECT index, verse
FROM bible
WHERE index >=
    Forms!f!startBook * 1000000 + Forms!f!startChapter + 1000 + Forms!f!startVerse
AND index <=
    Forms!f!endBook * 1000000 + Forms!f!endChapter + 1000 + Forms!f!Verse
SELECT index_, verse
FROM (select book * 1000000 + chapter * 1000 + verse as index_, * from bible) B
WHERE index_ >= 1 AND index_ <= 2
startIndex = Request("sbook") * 1000000 + Request("schapter") * 1000 + Request("sverse")