node.js - Insert into joined tables mysql node -


i new node , want use 4 tables inner join.

i have problem insert into. select, delete , update ok.

var database = require('../dbconnection');  addlist:function(list, callback){     return database.query("insert list_customers set c_l_name=?, c_l_name_c_id=? " , [list.c_l_name, list.c_name_id], callback); } 

i have error: column 'c_l_name_c_id' cannot null

primary key c_name_id not null auto increment , foreign key c_l_name_c_id not null

i have c_name_id in select inner join.

the error told problem. don't list.c_name_id, stays null, , c_l_name_c_id not null in db. somewhere in application need check if list.c_name_id, if it's null or not, if it's not null can call function, if it's null return message or whatever logic want implement there.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -