时间:2021-07-01 10:21:17 帮助过:3人阅读
function gethotsu($type=1){
$model = D(‘Plh_click‘);
$addtime = date(‘Y-m-d‘,time());
//$mounthname = MONTHNAME
if($type==1){
$sql = "SELECT cl.click_id,cl.supper_id,cl.add_time FROM sc_plh_click AS cl WHERE WEEK(‘$addtime‘,0) = WEEK(add_time,0) GROUP BY cl.supper_id ORDER BY count(cl.supper_id ) desc LIMIT 11";
}elseif ($type==2) {
$sql = "SELECT cl.click_id,cl.supper_id,cl.add_time FROM sc_plh_click AS cl WHERE MONTHNAME(‘$addtime‘) = MONTHNAME(add_time) GROUP BY cl.supper_id ORDER BY count(cl.supper_id ) desc LIMIT 11";
}else{
$sql = "SELECT cl.click_id,cl.supper_id,cl.add_time FROM sc_plh_click AS cl GROUP BY cl.supper_id ORDER BY count(cl.supper_id ) desc LIMIT 11";
}
mysql 提取本周 本月的记录 加深记忆
标签: