に私は4つのフィールドを持つテーブルがあります。field1
、field2
、field3
、field4
を、私は(field1
とfield2
とfield3
)が存在する場合ではないが存在するレジスタを挿入したいです。構文「に...挿入場所ではない」CodeIgniterの
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `id_est` and `id_course` and `DATE` not in (select `id_estudiante`,' at line 1
がどのように変換することができます:このクエリで次のエラーが表示される理由を知り
:私は二つのことをしたい
INSERT INTO mytable (`id_est`, `id_course`, `date`,`nro`) VALUES ('5','7','2020-06-11','') where id_est and id_course and date not in (select id_est, id_course, date from mytable)
:
私のクエリはこれですこのクエリはCodeIgniter構文に従っていますか?
$data =array( ) $this->db->insert('mytable', $data); $this->db->where_is_not();
感謝。フィールドid_est
とid_course
とdate
は重要であり、私は繰り返されません。
明確化:id_est
、id_course
、date
とnro
:私は次のフィールドとmytable
にデータを挿入する必要があります。
id_est id_course date nro
1 1 date1 1
1 1 date2 3
1 1 date2 2 (this register is not insert because id_est=1 and id_course=1 and date2 is in my table)
クエリからの値のnro – punit
このリンクはあなたのために役立ちます:[http://stackoverflow.com/questions/6047149/subquery-in-codeigniter-active-record][1] [1]:http://stackoverflow.com/questions/6047149/subquery-in-codeigniter-active-record – punit