access数据库排序问题,谁来帮帮忙呀?
access数据库
title abid email
--------------------------------
abc aa abc@dk.com
aaa ddd abc@dk.com
122 skl sa@dk.com
sll ksk sdfk@kk.com
aas kll abc@dk.com
怎么按邮箱数量最大的排最前面??
邮箱记录总数量。
------解决方案--------------------select *, count(email) as emailcount
from yourtable
order by emailcount
------解决方案--------------------select *
from a=yourtable,b=(select email,emailcount=count(email) from yourtable)
where a.email=b.email
group by emailcount desc,email;
------解决方案--------------------支持楼上,不过不用分组,可以用count么?楼上的取出的是每个email的出现次数?还是其他??
select title, abid, A.email
from yourtable AS A
right join
(select email
from yourtable
group by email
order by email desc) AS B
on A.email = b.email
这个应该差不多,只是我不太会右外连接