select class_download.classID,
       (select classtypeID from class where classID=class_download.classID)as classType, 
       count(class_download.classID) as countNum,
       (select classTitle from class where classID=class_download.classID)as classTitle from class_download
       group by class_download.classID order by countNum desc
我要做成这样的
select class_download.classID,
       (select classtypeID from class where classID=class_download.classID)as classType, 
       count(class_download.classID) as countNum,
       (select classTitle from class where classID=class_download.classID)as classTitle from class_download
       where classType='提交内容'/******提交的内容*****/
       group by class_download.classID order by countNum desc
但是加那个就错了哪个朋友帮我改一下谢谢了

解决方案 »

  1.   

    where classType='提交内容'
    改成 where classtypeID  = '提交内容' 试试
      

  2.   

    这种写法,真是.....
          select cls_d.classID,
          cls.classtypeID AS classType,
          cls.classTitle AS classTitle,
          count(cls_d.classID) as countNum
          from class_download cls_d
          left outer join class cls
          on cls.classID=cls_d.classID
          where cls.classtypeID='提交内容'/******提交的内容*****/ 
          group by cls_d.classID,cls.classtypeID,cls.classTitle order by countNum desc 
      

  3.   

    select class_download.classID, 
           c.classType, 
          count(class_download.classID) as countNum, 
          (select classTitle from class where classID=class_download.classID)as classTitle from class_download left class c on c.classtypeIDclassID=class_download.classID 
          where classType='提交内容' 
          group by class_download.classID order by countNum desc 
      

  4.   

    SORRY我看错了 真不好意思