求一SQL语句!谢谢!分不多!
表t1.申请出口的产品 
       合同编号,产品编号,产品版本,产品数量 
          pactno      pdtnumber   edition         mark1 
             k2007            p1                     v1                           5000 
             b2007            p1                     v2                           3000 
             c2007            p2                     v1                           8000 
 表t2   .已经出口的产品 
       pactno         pdtnumber      edition         mark2 
             k2007            p1                              v1                     2500 
             b2007            p1                              v2                     500 
 注:合同编号,产品编号,产品版本,组成唯一的一行数据 
 求:剩下还没出口的产品 
          pactno      pdtnumber   edition         mark1 
             k2007            p1                        v1                     2500 
             b2007            p1                        v2                     2500 
             c2007            p2                        v1                     8000 
 谢谢
------解决方案--------------------select A.pactno,A.,A.pdtnumber,A.edition,A.mark1-isnull(B.mark2) 
 from t1 A left join t2 B  
 on A.pactno=B.pactno and A.pdtnumber=B.pdtnumber and A.edition=B.edition
------解决方案----------------------修正 
 select A.pactno,A.pdtnumber,A.edition,A.mark1-isnull(B.mark2,0) 
 from t1 A left join t2 B  
 on A.pactno=B.pactno and A.pdtnumber=B.pdtnumber and A.edition=B.edition 
 --或者 
 select pactno,pdtnumber,edition,sum(mark1) from 
 (select * from t1 union all select pactno,pdtnumber,edition,-mark2 from t2)A 
 group by pactno,pdtnumber,edition
------解决方案--------------------select t1.pactno , t1.pdtnumber t1.edition ,  t1.mark1 from t1 where t1.pactno not in(select pactno from t2) and t1.pdtnumber not in(select pdtnumber from t2) and t1.edition not in(select edition from t2) 
 自己试试,我没有具体测试。有兴趣的加我的QQ群32097372。大家一起学习交流哦
------解决方案--------------------select pactno,pdtnumber,edition,mark1 
 from t1 
 where pactno not in 
 (select pactno  
 from t2)
------解决方案--------------------if object_id( 'pubs..t1 ') is not null 
    drop table t1 
 go   
 create table t1(合同编号 varchar(10),产品编号 varchar(10),产品版本 varchar(10),产品数量 int) 
 insert into t1(合同编号,产品编号,产品版本,产品数量) values( 'k2007 ', 'p1 ', 'v1 ',5000) 
 insert into t1(合同编号,产品编号,产品版本,产品数量) values( 'b2007 ', 'p1 ', 'v2 ',3000) 
 insert into t1(合同编号,产品编号,产品版本,产品数量) values( 'c2007 ', 'p2 ', 'v1 ',8000)