select to_char(date_published, 'yyyymm') yo from blog group by yo;
date_published 是timestamp with time zone 类型数据
我用cast() 试了一下 , 可group_by 不知道如何使用
貌似只能用extract() 了
小伙看你根骨奇佳,潜力无限,来学PHP伐。
Resolved You can directly call functions or stored procedures supported by the database through func
yonth = db.func.to_char(ArticleModel.date_published, 'yyyymm').label('yonth') archive_list = ( db.session.query(yonth, db.func.count(1)).group_by('yonth').all() )
Resolved
You can directly call functions or stored procedures supported by the database through func