如何为两列之间的值选择行 [英] How to select rows for a value that is in between two columns

查看:75
本文介绍了如何为两列之间的值选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的购物车项目中,我打算选择属于特定

条件的特定行。在表格中我有列,即CategoryId,ProductId,Season,SeasonFromMonthNumber

(值为1)和SeasonToMonthNumber(值为12)。

现在,使用当前月份数(6),我测试了以下代码。结果什么都没有。

任何人都可以给我正确的代码。



从产品WHERE CategoryId = 4和ProductId = 72的SELECT季节SeasonFromMonthNumber> = 6和SeasonToMonthNumber< = 6;

In my shopping cart project, I intend to select a particular row that falls into certain
conditions. In the table I have columns namely CategoryId,ProductId,Season,SeasonFromMonthNumber
(value is 1) and SeasonToMonthNumber(value is 12).
Now, using the current month number(6), I tested with the following code. The result is nothing.
Can anyone give me the correct code.

SELECT season from product WHERE CategoryId=4 and ProductId=72 and SeasonFromMonthNumber>=6 and SeasonToMonthNumber<=6;

推荐答案

这篇关于如何为两列之间的值选择行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆