【发布时间】:2016-01-21 12:17:03
【问题描述】:
我有两个表 event 和 guest 以及一个 eventGuest 表,它将它们连接在一起并包含有关来宾的一些信息(例如他们是否参加等),并且我试图插入 eventGuest 表而不创建类似的重复类型:
insert into eventGuest(eventID, GuestID, attended)
values(iEventID, iGuestID, bAttended)
where (select count(*) from eventGuest where eventID = iEventID and guestID = iGuestID) = 0
【问题讨论】:
-
好的,谢谢分享。成功了吗?
-
不,MySQL 不喜欢 where 的语法
-
链接有效,但我需要在临时表中为 ID (巧合)相同时的列设置别名
标签: mysql