查询这这就是我想要的:我怎样才能笨
SELECT DISTINCT first_name,last_name
FROM employees e
INNER JOIN salaries s ON e.emp_no = s.emp_no
WHERE e.birth_date > '1963-01-01'
AND s.salary>150000
我已经试过这一点,我得到了我想要的名字,但也是一个额外的12名。有些事情是错的。
$this->db->distinct();
$this->db->select('first_name, last_name');
$this->db->from('employees');
$this->db->join('salaries s', 'e.emp_no = s.emp_no', 'inner');
$this->db->where('e.birth_date > 1963-01-01');
$this->db->where('s.salary > 150000');
$result = $this->db->get();
您没有在'$ this-> db->中从'('employees')别名'employees';'在像您这样的员工为'slaries s'工作之后添加'e'。 – Wolf 2013-04-25 16:34:30