select (select count(*) from restore where fparent=article.id) as rcount,(select typeName from ptype where fid=article.typeid) as typeName from article请指点

解决方案 »

  1.   

    select b.tot as rcount,c.typename as typeName
     from article a
    inner join (select fparen,count(*) as Tot from restore group by fparen) b on a.id=b.fparen
    inner join (select fid,typeName from ptype)  c on a.typeid=c.fid  
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 最新版本:20070130http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
      

  2.   

    --tryselect 
    B.fid, B.typeName, 
    count(*) as rcount
    from article as A
    inner join ptype B on A.typeid=B.fid
    group by B.fid, B.typeName