假设一个工厂里有n种零件,现在按照零件的种类进行编组,为零件录入条形码。
插入数据
insert into Warehouse values(‘A1’,‘CA1004322’,‘Q100000’)
insert into Warehouse values(‘A2’,‘CB1003113’,‘Q100000’)
insert into Warehouse values(‘A3’,‘CC1003422’,‘Q100000’)
insert into Warehouse values(‘A4’,‘CD1002432’,‘Q100000’)
insert into Warehouse values(‘A5’,‘CE1000432’,‘Q100000’)
insert into Warehouse values(‘A6’,‘CF1000045’,‘Q100000’)
insert into Warehouse values(‘A7’,‘CG10043242’,‘Q1000003’)
insert into Warehouse values(‘A8’,‘CH10031413’,‘Q1000003’)
insert into Warehouse values(‘A9’,‘CL10034422’,‘Q1000003’)
insert into Warehouse values(‘A6’,‘CD10024432’,‘Q1000003’)
insert into Warehouse values(‘A5’,‘CE10004432’,‘Q1000003’)
insert into Warehouse values(‘A6’,‘CF10004045’,‘Q1000003’)
insert into Warehouse values(‘V1’,‘CUT10043242’,‘RT000345’)
insert into Warehouse values(‘V5’,‘UIY10031413’,‘RT000345’)
insert into Warehouse values(‘V4’,‘UY10034422’,‘RT000345’)
insert into Warehouse values(‘AB2’,‘RTD10024432’,‘RT000345’)
insert into Warehouse values(‘TR’,‘TR10004432’,‘RT000345’)
insert into Warehouse values(‘R3’,‘YF10004045’,‘RT000345’)
查询
select sequence 编号, Type as 零件名,bacode 条码 from Warehouse
行
行转列
结果
来源:CSDN
作者:varcad
链接:https://blog.csdn.net/varcad/article/details/103592859