table_act"/>

Php Mysql Left join

Published
2022-06-16
浏览次数 :  193

$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相等的时候

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