0
select substr(word,1,1) as alpha, count(*) as count
from words
group by substr(word,1,1);

我想在 PonyORM 中实现这个,谁能帮我写查询语句?提前致谢

4

1 回答 1

0

其实很简单

query = select(
    (w.word[0], count())
    for w in Words
)

由github上的 kozlovsky 回答

至于使用这个查询对象:

char_count_pair = list(query) 
for start_char, c in char_count_pair:
    print('char:', start_char, ', count:', c)
于 2018-05-21T10:16:58.173 回答