select a.* 
from 采购详细表 a inner join 采购信息表 b on a.buyID=b.buyID
where a.goodsID='A' and b.flag=1 and b.flag2=1

解决方案 »

  1.   

    select 
    b.Price
    b.Count
    from 采购信息表 as a ,采购详细表 as b 
    where a.flag=1 and a.flag2=1 and b.BuyId=a.BuyId and b.GoodsId='A'
      

  2.   

    select
     a.* 
    from
     采购详细表 a , 采购信息表 b 
    where
     a.buyID=b.buyID
    and
     a.goodsID='A' and b.flag=1 and b.flag2=1
      

  3.   

    select a.* , b.*
    from 采购信息表 a,采购详细表 b
    where a.flag = 1 and a.flag2 = 1 and b.id = 'A' and a.BuyId = b.BuyId
      

  4.   


    select a.*,b.price,b.count from 采购信息表 a inner join 采购详细表 b on a.BuyId=b.BuyId where a.flag=1 and a.flag=2 and b.商品ID='A'
      

  5.   

    搞定了,刚发了贴没回来看,发现这里的人都很热情啊我现在还想问下一个插入的问题,比如我想同时给2张表插入数据,要怎么写呢?比如写个Goodid=10的数据以前没写过有外键的SQL现在写起来比较困难,求帮忙