I’m trying to join tables and getting below error in codeigniter.
Error Number: 1054
Unknown column 'links.client_id' in 'on clause'
SELECT *, `keywords`.`key_id`, `keywords`.`key_name`
FROM (`keywords`)
LEFT JOIN `resources` ON `resources`.`client_id` = `links`.`client_id`
JOIN `links` ON `keywords`.`link_id` = `links`.`link_id`
WHERE `links`.`client_id` = '181' ORDER BY `links`.`link_id` desc
I have Links table and client_id column in there. I also spelt them correctly. Below is the query in link model:
$this->db->select('*');
$this->db->from('links');
$this->db->join('resources', 'resources.client_id = links.client_id', 'LEFT');
$this->db->where('link_id', $link_id);
$query = $this->db->delete('links');
return $query;
What could be wrong?
I think this line is wrong:
I am guessing you want something like:
because you are joining
resourcesandkeywords