SQL> select * from t1;
EMPLOYEE_ID ENAME
----------- --------------------
1 aaa
2 bbb
3 ccc
SQL> select * from t2;
EMPLOYEE_ID EE_START_DATE EE_END_DATE
----------- ------------------- -------------------
1 2007-08-20 14:04:09 2007-11-08 14:04:09
2 2007-10-29 14:04:33 2007-12-08 14:04:33
3 2007-12-18 14:04:56 2008-03-07 14:04:56
SQL> select sysdate from dual;
SYSDATE
-------------------
2007-11-28 14:05:26
SQL> select t1.employee_id,t1.ename,t2.ee_start_date,t2.ee_end_date
2 from t1,t2
3 where t1.employee_id = t2.employee_id(+)
4 and sysdate between ee_start_date and ee_end_date;
EMPLOYEE_ID ENAME EE_START_DATE EE_END_DATE
----------- -------------------- ------------------- -------------------
2 bbb 2007-10-29 14:04:33 2007-12-08 14:04:33
SQL> select t1.employee_id,t1.ename,t2.ee_start_date,t2.ee_end_date
2 from t1,t2
3 where t1.employee_id = t2.employee_id(+)
4 and sysdate between ee_start_date(+) and ee_end_date(+);
EMPLOYEE_ID ENAME EE_START_DATE EE_END_DATE
----------- -------------------- ------------------- -------------------
1 aaa
2 bbb 2007-10-29 14:04:33 2007-12-08 14:04:33
3 ccc
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/45259/viewspace-134955/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/45259/viewspace-134955/