A
电脑A
电脑A
光盘B
光盘A
手机B
手机C
如表,仅有一列A,我想用access实现:
查询出开头N个字符重复的个数,如N=2,则返回:
A count
电脑 2
光盘 2
手机 2
我的语句:select A,count(A) as count where conut(left(A,2))=2,报错说where 不能有聚合函数,该怎么写?
select left(A,2),COUNT(*) from 表 group by left(A,2) having count(*)=2
select count(*) as n, 字段 from 表 order by 字段 where n = 2
select A,COUNT(*) from 表 group by A having count(*)=2