我想要一个错误陷阱,如果数据已经存在,则不会将其插入到表中。我有这个代码,但它不起作用。
INSERT IGNORE INTO staging_table (playlist_id,terminal_id,userid) VALUES
(
(SELECT playlist_id FROM playlist_terminal WHERE playlist_id = i_playlistid),
(SELECT terminal_id FROM playlist_terminal WHERE playlist_id = i_playlistid),
(SELECT userid FROM playlist_terminal WHERE playlist_id = i_playlistid)
);