请问怎样在ACCESS里实现类似于SQLPLUS里SELECT COUNT(DISTINCT *) FROM TABLENAME?(100分)

  • 主题发起人 主题发起人 popzhu
  • 开始时间 开始时间
P

popzhu

Unregistered / Unconfirmed
GUEST, unregistred user!
SELECT COUNT(DISTINCT *) FROM TABLENAME?
 
select count * from tablename groupby colname
 
select count(*) from
(
select allfieldname,count(*) from tablename
having count(*)=1
group by allfieldname
)
 
我的问题可能不是太清楚,说明一下
SELECT ZIP,COUNT(DISTINCT NAME) FROM TABLENAME
GROUP BY ZIP
要求在这个邮编下,所有不同名字的人的个数!
 
select zip, count(*) from
(
select zip,name from tablename
having count(*)=1
group by zip,name
)
group by zip
 
ugvanxk你的答案不正确
1, 如果记录重复的NAME,你的方法是统计不进去的,你ONLY统计一条记录的NAME
2/ HAVING COUNT(*) 应该在GROUP BY 后面吧!
 
有没有人知道!
 
select zip, count(*) from
(
select zip,name from tablename
group by zip,name
)
group by zip
可以是可以,
但ACCESS没有类似UNIQUE这样的函数?
 
select zip,name,count(*) from tablename
group by zip,name
这样难道不行
 
不行
这样是同一个邮编同一个户名下有多少人家,
并非同一个邮编下,有多少个不同的人家!
 
select zip, count(*) from (select distinct (zip+name),zip from tablename) group by zip
 
可不可以用中间表
select zip,name into TempTable from tablename
group by zip,name
select zip,count(*) from TempTable
group by zip
 
select zip, count(*) from
(
select distinct zip,name //name,zip
from tablename
)
group by zip
我的应该能通过,在access 试了一下
elect kind,count(*) from
(select distinct alpha,kind from tbl_fix_time)
group by kind
 
我希望不用嵌套语句,直接有类是 count(distinct name)
的效果!
 
多人接受答案了。
 

Similar threads

回复
0
查看
978
不得闲
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
回复
0
查看
617
不得闲
后退
顶部