ASP 字段在有相同值,如何根据相同值多少排序
在一个字段中保存的是人的姓名,里面有相同值,我想根据相同值个数的多少从大到小排序,SQL语句要如何写?请高手支招。按照前面3位大师的语句还是不能通过。我写的语句selec...
在一个字段中保存的是人的姓名,里面有相同值,我想根据相同值个数的多少从大到小排序,SQL语句要如何写?请高手支招。
按照前面3位大师的语句还是不能通过。我写的语句
select [username],count([username]) as aa from [user] order by [aa] desc
下面是错误提示信息
Microsoft JET Database Engine '80040e21'
试图执行的查询中不包含作为合计函数一部分的特定表达式 'username' 。 展开
按照前面3位大师的语句还是不能通过。我写的语句
select [username],count([username]) as aa from [user] order by [aa] desc
下面是错误提示信息
Microsoft JET Database Engine '80040e21'
试图执行的查询中不包含作为合计函数一部分的特定表达式 'username' 。 展开
3个回答
展开全部
select [姓名],count([姓名]) as aa from [表] group by [aa] desc
----------------------------------------------------
我这个不是 order by 看好了 如果你没有看错的话 还是不好使就用下面的语句
select [姓名],count(select [姓名] from [表] where [姓名]=a.[姓名] ) as aa from [表] a group by [aa] desc
看好了 不是Order by
----------------------------------------------------
我这个不是 order by 看好了 如果你没有看错的话 还是不好使就用下面的语句
select [姓名],count(select [姓名] from [表] where [姓名]=a.[姓名] ) as aa from [表] a group by [aa] desc
看好了 不是Order by
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select [姓名],count(1) as num
from
Table
group by
[姓名]
order by num desc
--你写的group by 哪去了?
select [username],count([username]) as aa from [user]
group by
[username]
order by [aa] desc
from
Table
group by
[姓名]
order by num desc
--你写的group by 哪去了?
select [username],count([username]) as aa from [user]
group by
[username]
order by [aa] desc
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select * from
(select 值 ,count(*) as 值出现个数 from biao ) order by 值出现个数
(select 值 ,count(*) as 值出现个数 from biao ) order by 值出现个数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询