select * from 明细表 aa where not exists(select 1 from 计划表 bb where aa.钢种=bb.钢种 and aa.厚=bb.厚 and aa.宽 >=bb.宽度最小值 and aa.宽<=bb.宽度最大值 and aa.长 >=bb.长度最小值 and aa.长<=bb.长度最大值)

解决方案 »

  1.   

    select b.* from 计划表 a  inner join 明细表 b
    on a.计划号=b.所属计划号 and a.钢种=b.钢种 
    and b.厚=a.厚 and a.宽度最小值<=b.宽 and 
    a.宽度最大值>=b.宽 and a.长度最小值<=b.长 and a.长度最大值>=b.长 
      

  2.   

    select * from 明细表 A where 
    not exists 
    (select * from 计划表 where 计划号 = A.所属计划号 
      and 钢种 = A.钢种 and 厚 = A.厚 and 宽度最小值 <= A.宽 and 长度最小值 <= A.长)
      

  3.   

    select * from 明细表 A 
    where not exists(select 1 from 计划表 B 
                     where A.钢种=B.钢种 and A.厚=B.厚 and 
                           A.宽 >B.宽度最小值 and A.宽<B.宽度最大值 
                           and A.长 >B.长度最小值 and A.长<B.长度最大值)
      

  4.   

    Select * from 明细表 a where not exists
    ( select * from 计划表 where 钢种 = a.钢种 and 厚 = a.厚
    and a.宽 between 宽度最小值  and 宽度最大值
    and a.长 between  长度最小值 and 长度最大值)
      

  5.   

    select * from 明细表 A where 
    not exists 
    (select * from 计划表 where 计划号 = A.所属计划号 
      and 钢种 = A.钢种 and 厚 = A.厚 and 宽度最小值 <= A.宽 and 长度最小值 <= A.长)
      

  6.   

    select * from 明细表 A where 
    not exists 
    (select * from 计划表 where 计划号 = A.所属计划号 
      and 钢种 = A.钢种 and 厚 = A.厚 and 宽度最小值 <= A.宽 and 长度最小值 <= A.长)