MySQL extract this month's record to deepen memory

Source: Internet
Author: User


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) GR OUP 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_t IME) 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.suppe R_ID) desc LIMIT 11 ";
}

MySQL extract this month's record to deepen memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.