我有一张这样的桌子
SELECT V_EP_ID,V_START_DATE,V_END_DATE
FROM PGATEINTRA.dbo.EMPLOYEE_VACATIONS
ORDER BY V_EP_ID ASC
上述查询的输出是
V_EP_ID V_START_DATE V_END_DATE
------------------------------------------------------
28 2010-06-21 00:00:00 2010-06-21 00:00:00
103 2011-06-27 00:00:00 2011-06-27 00:00:00
103 2011-08-12 00:00:00 2011-08-12 00:00:00
104 2011-03-24 00:00:00 2011-03-24 00:00:00
104 2011-05-06 00:00:00 2011-05-06 00:00:00
104 2010-06-07 00:00:00 2010-06-08 00:00:00
104 2011-02-23 00:00:00 2011-02-25 00:00:00
...
我写了这样的声明
SELECT * FROM PGATEINTRA.dbo.EMPLOYEE_VACATIONS
WHERE V_START_DATE >='2010-06-21 00:00:00'
AND V_END_DATE <= '2010-06-21 00:00:00'
通过传递 v_start_date 和 v_end_date 从PGATEINTRA.dbo.EMPLOYEE_VACATIONS
我得到的输出为
V_ID V_TYPE V_EP_ID V_REASON V_START_DATE V_END_DATE
----------------------------------------------------------------------------
3 c 28 Took leave 2010-06-21 00:00:00 2010-06-21 00:00:00
7 c 109 Took leave 2010-06-21 00:00:00 2010-06-21 00:00:00
我希望输出动态获取 V_START_DATE 和 V_END_DATE 之间的所有 V_EP_ID FROM PGATEINTRA.dbo.EMPLOYEE_VACATIONS。