select substr(word,1,1) as alpha, count(*) as count
from words
group by substr(word,1,1);
我想在PonyORM中实现它,任何人都可以帮我编写查询语句吗?提前致谢
答案 0 :(得分:0)
实际上很容易
query = select(
(w.word[0], count())
for w in Words
)
kozlovsky在github
回答关于使用此查询对象:
char_count_pair = list(query)
for start_char, c in char_count_pair:
print('char:', start_char, ', count:', c)