日期:2014-05-17 浏览次数:20779 次
create table BOM(母件 nvarchar(100),子件 nvarchar(100),类型 int)
insert into BOM values('組合-25.400X1140.00','S45C-15.400X1140.00',1)
insert into BOM values('組合-25.400X1140.00','SCM420-25.400X045.500',1)
insert into BOM values('組合-25.400X1140.00','SS41-10.200X030.700',0)
insert into BOM values('組合-25.400X1140.00','SS41-23.300X011.300',0)
insert into BOM values('組合-25.400X1140.00','U01-0001',0)
insert into BOM values('組合-25.400X1140.00','U01-0002',0)
insert into BOM values('SCM420-25.400X045.500','E02-0050',0)
insert into BOM values('SCM420-25.400X045.500','E02-0182',0)
insert into BOM values('SCM420-25.400X045.500','E05-0019',0)
insert into BOM values('SCM420-25.400X045.500','E05-0093',0)
insert into BOM values('SCM420-25.400X045.500','E05-0130',0)
insert into BOM values('SCM420-25.400X045.500','E05-0137',0)
insert into BOM values('SCM420-25.400X045.500','E05-0137',0)
insert into BOM values('SCM420-25.400X045.500','E05-0145',0)
insert into BOM values('SCM420-25.400X045.500','E05-0253',0)
insert into BOM values('SCM420-25.400X045.500','E05-0343',0)
insert into BOM values('SCM420-25.400X045.500','SCM420-25.00X6.0M-B',0)
--跟级联查询一样 加载执行下面语句 显示只是母件不是子件
select 母件 from BOM where 母件 not in(select 子件 from BOM) group by 母件
--当点击母件时 显示其下类型为0的子件, 参数为点击的母件
select 子件
from BOM
where 母件='組合-25.400X1140.00' and 类型=0
if object_id('[BOM]') is not null drop table [BOM]
go
create table BOM(母件 nvarchar(100),子件 nvarchar(100),类型 int)
insert in