0
海兰,关系MySQL查询问题
我是新来的MySQL连接...我不明白现在的逻辑...
我有一个表:attributes
(1, 'display')
(2, 'processor')
(3, 'size')
和另一个表:products
(id, product_id, group, name, link_id)
(1, '12', display, Color, 0)
(2, '12', display, Resolution, 0)
(3, '12', display, Size, 0)
(4, '13', display, Color, 1) - this is the link_id (it holds the id of the same group of another product)
(5, '13', processor, 'Cache', 0)
... etc
所以我想建立一个Ajax,当管理员选择机生产线ct类别脚本验证它是否有一个喜欢的组来限制向该组添加字段。
所以基本上...我需要有一个查询返回:
(2, processor)
(3, size)
,当用户想要改变为ID = 13(因为display
组被用作链接)
这似乎在这里混合一点。你为“产品”发布的内容似乎确实是“属性”,反之亦然。所以'颜色'等属性,对吧?而显示器是一种产品?请更正并发布您的DDL以创建这些表格。 –
在“组”列中,您应该引用属性标识,而不是名称。另外,在产品表中有一个“id”和“product_id”是令人困惑的。该设计可以承受更多的工作。 –