当前位置: 代码迷 >> ASP >> 3表聚合 Sum INNER JOIN 合写的有关问题
  详细解决方案

3表聚合 Sum INNER JOIN 合写的有关问题

热度:975   发布时间:2012-02-03 22:02:47.0
3表聚合 Sum INNER JOIN 合写的问题
3个表
Userlist   用到字段ID,UserType
BlogArticle   用到字段   UserId,Hits,Comments
BlogConfig   用到字段   UserId,BlogTitle,BlogIntro

其中用户表UserList的ID=博客文章BlogArticle的UserId=博客配置BlogConfig的UserId

UserType=2   表明是专家

我要得到所有专家的博客的博客名称BlogTitle、博客简介BlogIntro、
博客总文章数Hits、博客文章总点击数Comments   按点击数Comments   排

Sql   语句怎么写啊?

------解决方案--------------------
TRY:

Select a.[ID],b.Hits,b.Comments,c.BlogTitle,c.BlogIntro From ([UserList] a inner join [BlogArticle] b on a.[ID]=b.UserId ) inner join BlogConfig c on a.[ID]=c.UserId Where a.UserType=2 Order by b.Comments Desc
------解决方案--------------------
顶楼上
  相关解决方案