select a.SrcID,a.Sequence from #tableBOMItems a join #tableBOMItems b on charindex(ltrim(a.Sequence),b.SrcID)>0 where ItemMaster_ItemFormAttribute in ('制造件') and LevelCode not IN(0,1)
select a.SrcID,a.Sequence from #tableBOMItems a join #tableBOMItems b on charindex(ltrim(b.SrcID),a.Sequence)>0 where ItemMaster_ItemFormAttribute in ('制造件') and LevelCode not IN(0,1)
where ItemMaster_ItemFormAttribute in ('制造件') and LevelCode not IN(0,1)
0 0 0 主件
1 001 001 主件
2 1234 001_1234 制造件
3 1235 001_1234_12345 采购件
4 1236 001_1234_12345_1236 采购件
2 1237 001_1237 虚拟件
3 1238 001_1237_1238 制造件
4 1239 001_1237_1238_1239 采购件我的意思就是制造件下面的子件反正就不显示出来了。具体的写法我想用LIKE 这样。
好像不大行。
from #tableBOMItems a join #tableBOMItems b on charindex(ltrim(b.SrcID),a.Sequence)>0
where ItemMaster_ItemFormAttribute in ('制造件') and LevelCode not IN(0,1)