日期:2014-05-17 浏览次数:21103 次
CREATE TABLE T150 ( xh NUMBER(2), rq DATE ); INSERT INTO T150 VALUES(0, to_date('2012-02-27', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(0, to_date('2012-02-28', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(0, to_date('2012-02-29', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(1, to_date('2012-03-01', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(1, to_date('2012-03-02', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(1, to_date('2012-03-03', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(2, to_date('2012-03-06', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(2, to_date('2012-03-07', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(2, to_date('2012-03-08', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(3, to_date('2012-03-10', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(3, to_date('2012-03-11', 'YYYY-MM-DD')); INSERT INTO T150 VALUES(3, to_date('2012-03-12', 'YYYY-MM-DD')); CREATE TABLE T151 ( xh NUMBER(2), rq DATE ); -- T151中的数据是典型的,(1条未取,取1条,取2条,全取) INSERT INTO T151 VALUES(1, to_date('2012-03-01', 'YYYY-MM-DD')); INSERT INTO T151 VALUES(2, to_date('2012-03-06', 'YYYY-MM-DD')); INSERT INTO T151 VALUES(2, to_date('2012-03-07', 'YYYY-MM-DD')); INSERT INTO T151 VALUES(3, to_date('2012-03-10', 'YYYY-MM-DD')); INSERT INTO T151 VALUES(3, to_date('2012-03-11', 'YYYY-MM-DD')); INSERT INTO T151 VALUES(3, to_date('2012-03-12', 'YYYY-MM-DD'));
------解决方案--------------------
select * from a where (xh,rq) not in(select xh,rq from b)
这样好像也行