我想使用JavaScript模板字符串创建MySQL查询。 我只想查询不为空的列
我不知道该怎么做
var payload= {
id: 255,
color : this.editedItem.color,
state : this.editedItem.state,
pir : this.editedItem.pir,
override: this.editedItem.override,
};
var topic=`INSERT INTO sensors_tbl (sensor_id,s_color,s_state,s_pir,s_override,last_checked)
VALUES (${payload.id},"${payload.color}","${payload.state}","${payload.pir}","${payload.override}",NOW());`;
例如,如果payload.state=""
我想从查询中将其删除。
谢谢。