请教同组物品查询的方法
Create TABLE MAIN.[object_group]([object_title] varchar(50)
,[object_para] varchar(50)
,[group_title] varchar(50)
,[group_value] varchar(50)
, Primary Key(object_title,object_para,group_title,group_value)
);
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","红木八仙桌","品种","家具");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","红木八仙桌","材质","红木");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","红木八仙桌","包装","一类包装-大");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("茶几","红木几","品种","家具");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("茶几","红木几","材质","红木");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("茶几","红木几","包装","二类包装-中");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","平头案","品种","家具");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","平头案","材质","梨花木");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("桌子","平头案","包装","一类包装-大");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("椅子","电脑转椅","品种","办公");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("椅子","电脑转椅","包装","二类包装-中");
Insert Into [object_group] ([object_title],[object_para],[group_title],[group_value]) Values("椅子","电脑转椅","材质","革");
[object_title] 对象名称
[object_para] 对象参数
[group_title] 组名称
[group_value] 组取值
求查询语句写法:
输入:对象名称,对象参数
输出:和输入对象至少具有两个相同组名称和组取值的其他对象列表
通俗讲,就是:至少有两个分类定义相同的其他物品
也可以扩充为:有若干个分类定义相同
[ 本帖最后由 njy23000 于 2010-11-19 16:48 编辑 ]