求取日期區間最大建立日的節點SQL
今有如下資料
date_s (日期起) date_e(日期迄) inp_date (建立日) price
----------------------- ----------------------- ----------------------- -------
2009-11-10 00:00:00.000 2010-06-12 00:00:00.000 2009-07-07 00:00:00.000 1000
2009-11-07 00:00:00.000 2009-12-07 00:00:00.000 2009-10-28 00:00:00.000 850
2009-11-07 00:00:00.000 2009-11-16 00:00:00.000 2009-10-29 00:00:00.000 700
2009-11-09 00:00:00.000 2009-11-15 00:00:00.000 2009-10-29 00:00:00.000 450
2009-11-09 00:00:00.000 2009-11-15 00:00:00.000 2009-10-30 00:00:00.000 500
可否求出
date_s date_e price
----------------------- ----------------------- -------
2009-11-07 00:00:00.000 2009-11-08 00:00:00.000 700
2009-11-09 00:00:00.000 2009-11-15 00:00:00.000 500
2009-11-16 00:00:00.000 2009-11-16 00:00:00.000 700
2009-11-17 00:00:00.000 2010-06-12 00:00:00.000 1000
我想求出 在特定日期期間,價格調整的節點以最後輸入日為正確資料的資料,
請各位幫忙!!!
------解决方案--------------------
SQL code
最好给出表结构,测试数据,计算方法和正确结果.