product(maker,model,type)
pc(model,speed,ram,hd,price)
laptop(model,speed,ram,hd,screen,price)
printer(model,color,type,price)
题目是删除所有不生产打印机的厂商生产的笔记本电脑。。
我写的语句是
delete from product
where maker not in(select maker from product where type='printer')
      and type='laptop';
求指导

解决方案 »

  1.   

    delete a from product a left join product b 
    on a.maker=b.maker
    where b.type='printer' and  a.type='laptop';
      

  2.   

    MYSQL的语法有些限制。delete a from product a Left Join (select maker from product where type='printer') b ON a.maker=b.maker
    where a.type='laptop' and b.maker is Null;
      

  3.   

    MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html