编一个自定义函数,取字母部分吧:
Public Function qzm(mytext)
d = Len(mytext)
e = ""
For ii = 1 To d - 1
If Asc(Mid(mytext, ii, 1)) > 57 Or Asc(Mid(mytext, ii, 1)) < 48 Then e = Mid(mytext, 1, ii)
Next ii
qzm = e
End Function
再把查询改成:
SELECT DISTINCTROW qzm([字段1]) AS aa, Sum([字段2]) AS bb
FROM db
GROUP BY qzm([字段1]);
我试了一下,通过