有a,b,c三个表,字段分别为
a:shopid,shopname,telephone
b:menuid,dish,price
c:rangeid,shopid,buildingid现在要求,当buildingid=1的时候列出shopname,telephone,dish,price四个字段
谢谢

解决方案 »

  1.   

    select a.shopname,a.telephone,b.dish,b.price 
    from a,b,c 
    where a.shopid = b.menuid and a.shopid = c.rangeid and c.buildingid=1这样可以么?
      

  2.   

    dish,price不知道怎么列  FK是什么?
      

  3.   

    不好意思太急,漏了
    应该是:
    有a,b,c三个表,字段分别为
    a:shopid,shopname,telephone
    b:menuid,shopid,dish,price
    c:rangeid,shopid,buildingid现在要求,当buildingid=1的时候列出shopname,telephone,dish,price四个字段大家帮忙看看谢谢
      

  4.   

    select a.shopname,a.telephone,b.dish,b.price 
    from a,b,c 
    where a.shopid = c.shopid and b.shopid = c.shopid and c.buildingid=1