table_act"/>

Php Mysql Left join

Published
June 16, 2022
浏览次数 :  1

$this->staff_data = $wpdb->get_results("SELECT staff.*,department.dep_name FROM " . $this->table_activator->staff_table ." as staff LEFT JOIN ".$this->table_activator->department_table." as department ON staff.department = department.dep_id");

//staff 是 staff_table的别称,department 是department_table别称,选择staff的全部列,department的 dep_name列数据, 当 staff 表里的 department 和 department 表里的dep_id相等的时候

Top