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
< /code>
Ich habe dies ausprobiert und ich bekomme die gewünschten Namen, aber auch zusätzliche 12 Namen. Etwas stimmt nicht. < /P>
$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();
das ist was ich will: < /p> [code]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 < /code> Ich habe dies ausprobiert und ich bekomme die gewünschten Namen, aber auch zusätzliche 12 Namen. Etwas stimmt nicht. < /P> $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');
Wie kann ich diese Abfrage mit den Query Builder -Methoden von Codesigniter schreiben?
SELECT M. * , P.name as page_name
FROM omc_menu AS M
LEFT JOIN omc_page AS P ON M.page_id = P.id
WHERE...