是不是要达到下面的效果:
求出B集合中, p1, p2...pn没有在集合A中出现的所有记录?(顺便说一下, 两个集合求集, 求差等时, 集合要是同质的。 而楼主上面说的A集合与B集合并不是同质的, 而是通过一些比较关键字来联系起来)

解决方案 »

  1.   

    p1, p2...pn是在A和B中都出现过的
    我要求的是B(y1,y2,...yn)这部分, 通过和A求交后作判断
      

  2.   

    --楼主数学很好,都看晕了,不知道是不是这个意思:create table a
    (
    c1 varchar(30)
    )create table b
    (
    c1 varchar(30)
    )insert into a
    select 'p1' union select 'p2' union
    select 'p3' union select 'p4' union
    select 'pn' union select 'x1' union
    select 'x2' union select 'x3' union
    select 'x4' union select 'xn' insert into b
    select 'p1' union select 'p2' union
    select 'p3' union select 'p4' union
    select 'pn' union select 'y1' union
    select 'y2' union select 'y3' union
    select 'y4' union select 'yn' 
    select * from b
    where c1 not in (select c1 from a)drop table a
    drop table b /*y1
    y2
    y3
    y4
    yn*/