有谁知道如何获取两者之间的范围数据?
Do any know how get range data in between?
我想通过获取它来获取两个变量之间的数据 我将在 table
中获取估计数据
select rate
from tbl_reporate
where purity='IF'
AND color='G'
AND weight_from >= '1.78'
AND '1.78' <= weight_to
AND shap='ROUND'
我得到了多个数据但不正确
13500
27500
35500
46500
74500
您似乎想要:
and weight_from <= 1.78 and weight_to >= 1.78
这会检查给定的数字 (1.78
) 是否属于范围 weight_from/weight_to
.
请注意,这里使用的是文字数字(没有单引号),而不是字符串(数字和字符串的比较规则不同!)。我希望两列都是数字,但如果它们是字符串,则需要转换它们:
and weight_from + 0 <= 1.78 and weight_to + 0 >= 1.78
这是表达范围的规范方式:
and 1.78 between weight_from and weight_to
我想通过获取它来获取两个变量之间的数据 我将在 table
中获取估计数据select rate
from tbl_reporate
where purity='IF'
AND color='G'
AND weight_from >= '1.78'
AND '1.78' <= weight_to
AND shap='ROUND'
我得到了多个数据但不正确
13500
27500
35500
46500
74500
您似乎想要:
and weight_from <= 1.78 and weight_to >= 1.78
这会检查给定的数字 (1.78
) 是否属于范围 weight_from/weight_to
.
请注意,这里使用的是文字数字(没有单引号),而不是字符串(数字和字符串的比较规则不同!)。我希望两列都是数字,但如果它们是字符串,则需要转换它们:
and weight_from + 0 <= 1.78 and weight_to + 0 >= 1.78
这是表达范围的规范方式:
and 1.78 between weight_from and weight_to