问题标签 [between]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
7459 浏览

mysql - 需要知道 between 和 like 是否可以一起使用或在 sql 中更好

这是我的查询:

这工作得很好,问题是我必须LIKE在这些上使用 a 因为它们包含 3 个额外的数字(所以这是一个时间戳加上 3 个数字)。

因此我strtotime在 php 中使用 a 并尝试在数据库中匹配这些,但它们包含额外的 3 位数字。有没有办法可以重做这个 sql 或LIKE为每个时间戳添加一个子句?

就像是

0 投票
6 回答
1649 浏览

sql - MySQL 复合索引和运算符 BETWEEN

我对此查询有疑问:

您认为为 begin_at 和 finished_at 列创建复合索引有意义吗?还是只为 begin_at 创建索引有意义?

0 投票
4 回答
25928 浏览

mysql - 什么是mysql的“BETWEEN”性能超过..?

在(特别是)mysql中查询以下内容时是否有更好的性能:

超过:

还是 BETWEEN 语法只是被第二个 sql 替换了?

0 投票
2 回答
514 浏览

php - 如何查询数据库的中间值并按最近的排序?

我正在我的 MySQL 数据库中搜索一个值,并希望按最近的项目对结果进行排序。

例子:

我在查询中搜索值 150,现在执行以下操作:

SELECT * FROM table WHERE field BETWEEN 100 AND 200
100 和 200 之前通过简单的加法和减法计算。但是现在我的结果搞砸了,因为它给了我结果,就像它们被保存到数据库一样。

是否可以在 MySQL 中对结果进行排序,或者我必须在之后使用 PHP 对它们进行排序?

0 投票
3 回答
1932 浏览

mysql - Mysql wildcard query problem

#xA;

Results

#xA;

How would I avoid the Jan 10 results?

I have tried a few different combination with %, <=, etc.

Any ideas?

Thanks

0 投票
3 回答
506 浏览

mysql - MySQL BETWEEN 查询 w/ BETWEEN ?和?

谁能指导我或提供双问号如何在 BETWEEN 比较中工作。我无法让它工作,我无法在 MySQL 网站和 Google 上找到或搜索这些数据 - 一堆随机结果。

0 投票
1 回答
1103 浏览

sql - 如何使用 COUNT、SUM、CASE 和 BETWEEN 将此 SQL 查询转换为 Perl DBIx::Class?

如何将此 SQL 查询转换为 Perl DBIx::Class代码?

0 投票
1 回答
1024 浏览

sql - Query start and stop dates between two date fields

I have a start order date field and a stop order field I need to check the database to see if the start and stop orders are outside of any of the pay period start and end fields. Say 01-aug-10 and 14-aug-10 and 15-aug-10 and 28-aug-10 and 29-aug-10 and 11-sep-10 are all of the pay periods in one month. The start order 01-aug-10 and the end order is 14-aug-10. Yet when I do a SQL that said (where end order not between pay period start and pay period end) the 01-aug-10 to 14-aug-10 still shows up. My needs are if it finds any dates that match stop looking and go to the next record start order and stop order and start the next search till we hit the end of the record search requirements.

I am looking to search by month and by year to keep the query responsive. The database is quite large. My query seams like it only does the between check once and then it shows all of the data that does fit between the pay period start and stop, and that is the data I do not want to see!

0 投票
5 回答
604 浏览

mysql - MySQL 日期和 BETWEEN 的奇怪之处

我正在运行查询以获取介于特定日期之间的行(本示例中为当前日期和 7 天前)。

我试着把它写成:

但它返回了 0 行。我不明白为什么它不起作用,我尝试将其重写为:

哪个确实有效。

为什么第一个返回 0 行但第二个按预期工作?据我所见,它们在功能上应该是等效的。

cs_created 是一个日期时间。

0 投票
2 回答
1741 浏览

php - MYSQL获取一定时间范围内的数据

大家好,正确获取此 MYSQL 查询时遇到问题

问题是 20110212 是由 php 动态生成的,这就是我使用 DATE/INTERVAL COMBO 的原因。

鉴于您知道该两周周期的开始日期,我想做的是在 2 周时间范围内选择条目。

提前致谢