关于进行sql查询按字段me_createTime按月进行排序
使用函数:date_format 按月进行分组查询,并按月进行排序
上代码
$sql="select date_format(me_createTime,'%Y-%m')as create_month,count(me_id) as me_num from {$SETTING['db']['prefix']}member where me_state in(1,2) and sm_id='$sm_id' group by date_format(me_createTime,'%Y-%m') order by date_format(me_createTime,'%Y-%m') desc";