I need your help. The following is my database table. http://i42.tinypic.com/10xh4j7.png A small request to please have a look at the image.
我需要你的帮助。以下是我的数据库表。 http://i42.tinypic.com/10xh4j7.png一个小请求,请看看图像。
My problem is, when I want to retrieve the rate from date_from and date_to. For Eg: Lets say retrieving_date = 2013-11-14. rs = stat.executeQuery("select rate from rate_chart where '"+retrieving_date+"' BETWEEN date_from AND date_to");
我的问题是,当我想从date_from和date_to中检索速率时。例如:让我们说检索_date = 2013-11-14。 rs = stat.executeQuery(“从rate_chart中选择率'”+ retrieveving_date +“'BETWEEN date_from AND date_to”);
This query gives me my required result, for the 11th month. I get 10.40 as my required rate with the above query.
这个查询给了我第11个月所需的结果。我通过上述查询获得了10.40作为我的要求费率。
Lets say, rate has never been changed since 2013-11-26, and now my retrieving_date is 2013-12-20. And now, when I try to execute the above query, it doesn't work. No errors but doesn't give me the last rate. In my case, is 10.80 as mentioned in the above image.
可以说,自2013-11-26以来,费率从未改变过,现在我的检索日期是2013-12-20。现在,当我尝试执行上述查询时,它不起作用。没有错误,但没有给我最后的费率。在我的情况下,如上图所示是10.80。
I actually want to search between dates even if the stop date or (date_to) is null.
我实际上想要在日期之间搜索,即使停止日期或(date_to)为空。
No, idea how to go forth with this. Stuck for a while now. Any help would be greatly appreciated.
不,想知道怎么做这个。现在坚持了一段时间。任何帮助将不胜感激。
1 个解决方案
#1
0
if the stop date (or date_to) is null, set it to the current date.
如果停止日期(或date_to)为空,则将其设置为当前日期。
#1
0
if the stop date (or date_to) is null, set it to the current date.
如果停止日期(或date_to)为空,则将其设置为当前日期。