I want Chack If Value exists in coulmn, If value exist do not insert to table. If not exist insert to table a new data.
I tried this but not works..
my code in node.js `
//add new meeting
async function addNewMeeting(meeting: Meeting): Promise<Meeting>{
const sql = `INSERT INTO meetings Values (
DEFAULT,
${meeting.meeting_code},
'${meeting.meeting_start_date}',
'${meeting.meeting_end_date}',
'${meeting.meeting_description}',
'${meeting.meeting_room}'
)`;
const result:OkPacket = await dal.execute(sql);
meeting.id = result.insertId;
return meeting;
}
`
I tried to chack if the value - '2022-10-15 07:03:42' exist or not. If not exists insert to table a new data. if exist send a error that cannot insert a new meeting because there is already meeting at this time.
thanks :)