0
道具 PROPID PropDescription插入到交集表引用外键
多对多的关系
图片 图像标识 ImageDescription
Image_has_Prop Prop_PropID Image_Imag eID
在我的应用程序中,我需要将数据插入Image_has_Prop。用户键入ImageId,然后从显示PropDescription字段的JComboBox中选择Prop。我试图弄清楚如何将描述与外键相关联,甚至有可能吗?因为我认为PropDescription可能不是唯一的。下面是我的尝试,我认为如果我诚实地使用mysql数据库,它是如此。
INSERT INTO Image_has_Prop
(Image_ImageID, Prop_PropID)
VALUES
(Select ImageID FRom Image where ImageID ='1', SELECT PropId FROM Prop Where PropDescription = 'Tablets');
如我所料,做工的完美谢谢! – Peddler 2012-03-09 15:49:59