现有两张表
表1格式和表2一样,如下:
时间       料号         批次         数量           剩余数量在两张表的料号,批次和数量一致的情况下,如何取出表1的时间,数量和剩余数量

解决方案 »

  1.   

    select 时间,数量, 剩余数量 from A where exsits (select 1 from B where B.料号 = A.料号 AND B.批次= A.批次 AND B.数量 = A.数量)
      

  2.   

    直接
    select ...from tb1,tb2 where tb1.料号=tb2.料号 and tb1.批次=tb2.批次 
      

  3.   

    select a.时间, a.数量, a.剩余数量 from 表1 a, 表2 b where a.料号 = b.料号 and a.批次 = b.批次 and a.数量 = b.数量
      

  4.   

    直接把两个表INNER JOIN 一下就完了,用料号,批次和数量作为链接条件
      

  5.   

    是这样吗?
    select 表1.时间,表1.数量,表1.剩余数量 from 表1,表2
     where 表1.料号=表2.料号 and 表1.批次=表2.批次 and 表1.数量=表2.数量