您的位置:程序门 -> ms-sql server -> 疑难问题



一条查询语句,帮忙给看看问题出在哪了?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


一条查询语句,帮忙给看看问题出在哪了?[已结贴,结贴人:ykren]
发表于:2007-05-30 21:30:17 楼主
select   distinct   tagname,   count(tagname)   as   tagcount   from   tag   where   (adduserid   =   65)   and   (tagcount   >   1)   group   by   tagname   order   by   tagcount   desc

执行后报错:列名   'tagcount '   无效。

怎么解决?
发表于:2007-05-30 21:33:351楼 得分:3
select   tagname,tagcount   from

select   distinct   tagname,   count(tagname)   as   tagcount,adduserid   from   tag    
group   by   tagname,adduserid   order   by   tagcount   desc
)a
where   (adduserid   =   65)   and   (tagcount   >   1)
发表于:2007-05-30 21:33:432楼 得分:15
select   distinct  
tagname,  
count(tagname)   as   tagcount  
from   tag  
where   (adduserid   =   65)  
group   by   tagname  
having     count(tagname)   >   1
order   by   tagcount   desc
发表于:2007-05-30 21:33:473楼 得分:2
select   *   from

select   distinct   tagname,   count(tagname)   as   tagcount   from   tag   where   (adduserid   =   65)   and   (tagcount   >   1)   group   by   tagname  
)   t
order   by   tagcount   desc


快速检索

最新资讯
热门点击