查詢時,用同一個日期,取前30天、後30天的資料
資料庫: DB2 v8.2
語法: SQL
select
date(days(PICKDATE) + 0) as CC,
date(days('2014-09-01') - 30) as "DD-30",
date(days('2014-09-01')) as DD,
date(days('2014-09-01') + 30) as "DD+30",
KEYINDATE as 建檔日期,
POINTDATE as 指定到貨日期,
STARTDATE as 出車日期,
PICKDATE as 指定提貨日期,
FC_EXPECT_DATE as 首班車_出車日期
from TRNORDER
where PICKDATE
between date(days('2014-09-01') - 30) and date(days('2014-09-01') + 30)
and FC_EXPECT_DATE = '2014-09-01'
沒有留言:
張貼留言