问题描述
- 这个ACCESS语句怎么写?
-
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
解决方案三:
access查询语句在哪里写
解决方案四:
select A,COUNT(*) from 表 group by A having count(*)=2
时间: 2024-07-28 12:27:04