几个实用的mysql查詢

Published
2022-06-09
浏览次数 :  187

查询上月入职员工

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));

  • 标签1
  • 标签1
  • 标签1
Top