请求一条查询语句。。。。
用户表:nt_user
id 自动编译
username 用户名
.........
统计表:nt_title
titleid 自动编译
titleuser 用户名 与nt_user 的username 用户名相等
......
图片表:Nt_Imgbook
id 自动编译
titleid 与 nt_score的titleid 相等
...
评分表:nt_score
imageid (字段)与Nt_Imgbook的 id 相等
score 分数
count 张数
我想要的是排列所有用户的精华图片,(条件是score>100),还有的就是统计属于这个用户有多少张精华图片
下面是我写的。。但是只得到一个用户的(还有的就是我没有用到用户表)
SELECT TOP 13 titleuser, count(count) AS f FROM nt_title,Nt_score,Nt_Imgbook WHERE Nt_Imgbook.id=Nt_score.imageid and nt_title.titleid=Nt_Imgbook.titleid and score>100 GROUP BY titleuser
ORDER BY count(icount) DESC;