我的列有昏迷分隔的id列表。如果脚本试图插入现有行,我想要合并列表。是否可以只使用SQL?这是我的插入脚本:
INSERT INTO Movie ( title, subtitle, year, filmIds, masterIds )
(select originaltitel, originaluntertitel, entstehungsjahr, GROUP_CONCAT(filmid), GROUP_CONCAT(master_id)
from film
where originaltitel is not null
group by originaltitel
)
union
(select titel, untertitel, entstehungsjahr,GROUP_CONCAT(filmid), GROUP_CONCAT(master_id)
from film
where originaltitel is null
group by originaltitel
)