开发者

Date Range SQL Query

Schedule_ID---Card No----FromDate----ToDate

4-------------1000058----01-Aug-10---31-Aug-10
5-------------1000058----01-Sep-10---30-Sep-10
6-------------1000058----06-Oct-10---26-Oct-10
7-------------1000099----06-Oct-10---26-Oct-10

What will be the query so i can find that is 08-Oct-10 Exist for 1000058 in table

SELECT Schedule_ID 
FROM TBL_SCHEDULE 
WEHRE CARD_NO = 1000058 AND ...开发者_运维技巧....... (WHAT MORE)

Like this query must result Schedule_ID = 6 because this date 08-Oct-10 is in range of Schedule_ID = 6.


SELECT Schedule_ID 
FROM TBL_SCHEDULE 
WHERE CARD_NO = 1000058 
  AND yourDate BETWEEN FromDate AND ToDate
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜