在 ponyorm 中按子串分组
Group by substring in ponyorm
select substr(word,1,1) as alpha, count(*) as count
from words
group by substr(word,1,1);
我想在PonyORM中实现这个,谁能帮我写查询语句?提前致谢
其实很简单
query = select(
(w.word[0], count())
for w in Words
)
科兹洛夫斯基在 github
上回答
关于使用这个查询对象:
char_count_pair = list(query)
for start_char, c in char_count_pair:
print('char:', start_char, ', count:', c)
select substr(word,1,1) as alpha, count(*) as count
from words
group by substr(word,1,1);
我想在PonyORM中实现这个,谁能帮我写查询语句?提前致谢
其实很简单
query = select(
(w.word[0], count())
for w in Words
)
科兹洛夫斯基在 github
上回答关于使用这个查询对象:
char_count_pair = list(query)
for start_char, c in char_count_pair:
print('char:', start_char, ', count:', c)