几个实用的mysql查詢

Published
June 9, 2022
浏览次数 :  0

查询上月入职员工

SELECT *,DATEDIFF(month,hire_date,GetDdate()) FROM hr_table

//mysql 没有month 或者day选项,直接是 last_date,this_date 相差

查询合同即将到期员工

$endingstaff = $wpdb->get_col($wpdb->prepare("SELECT nce FROM " . $this->table_activator->staff_table . " WHERE DATEDIFF(nce,CURDATE()) < %d",30));

Top