php - 如何在 select 语句中使用 'between'

标签 php mysql

这应该是一个简单的解决方案,但我无法解决它。 我有一张 table enter image description here

这是我的查询

 $salary=2000;  

select deductions from nhif_tbl where to_end <=$salary and start_from >= $salary;

查询返回 null。 我的问题是如何修改查询以便在这种情况下获得正确的扣除“60”

最佳答案

select deductions from nhif_tbl where to_end >=$salary and start_from <= $salary;

关于php - 如何在 select 语句中使用 'between',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21593739/

相关文章:

mysql - 为什么在多次执行查询后收到一条成功消息,显示 `2 rows inserted`?

php - zend framework2 使用 composer 安装骨架应用程序 ZendSkeletonApplication

javascript - 导航栏,包含在所有文件中

php - 在 PHP 中将十六进制转换为 int64

用于客户数据的 PHP MySQL 嵌套列表

php - 如何为树结构开发数据库模式(有向无环图)

php - CodeIgniter 将视频从 localhost 上传到 YouTube

php - Web 应用程序 : Preprocess and send all items in one page load, 或将项目分成单独的客户端请求?

PHP 日历在一周中的正确日期显示日期

mysql - MySQL 5.5.25需要给参数 "log-output = TABLE"分配多个表