テーブルに参加してcodeigniterで以下のエラーを取得しようとしています。テーブルを結合する際の不明な列MySQL
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
私はそこにリンクテーブルとクライアントID列を持っています。私はまたそれらを正しく綴りました。以下はリンクモデルのクエリです:
$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;
何が間違っている可能性がありますか?
私はキーワードにclient_idを持っていません... –
@ Jae Kun Choiあなたは 'keywords'と' resources'という2つのテーブルを結合しているので、それらの関係が何であるかを指定する必要があります。 – jeroen