也就是说 cname列的  哪个 一个公司    通过 子公司branches表和branches_services表使用 services表里的所有服务

解决方案 »

  1.   

    clients表的 哪个cname  通过子公司branches表和branches_services表 使用 services表里的6个不同的服务 ----------
    能读通吗?
      

  2.   

    clients表里的 101    沃尔玛(美国) 通过 branches表 1011    101    社团行政中心    加州 
    1012    101    结算部门        纽约 
    1013    101    客户服务中心    印地安那州 branches_services表            使用了 services表里的6个不同的服务
      
    1011    1                     1      财务管理      1500 
    1011    2                     2      医疗服务      500 
    1011    3                     3      数据管理      300
    1011    4                     4      行政管理      500 
    1012    1                     5      客户服务      2500 
    1013    5                     6      保险          600
    1013    6 ----------------------------------------------------------------------------------------
    select cname from 
    (select distinct c.cid, c.cname, br.sid from clients c,branches b,branches_services br where c.cid=b.cid and b.bid=br.bid) as cb
    group by cb.cid having count(*)=(select count(*) from services);
    -----------------------------------------------------------------------------------------
    上面这个是正确答案  不过我想知道还有没有别的写法