Create table OrderInfo
(
ordernum VARCHAR2(17),
supplier VARCHAR2(17),
pol VARCHAR2(17),
pod VARCHAR2(17),
etd DATE,
eta DATE,
productcode VARCHAR2(17),
qty Number(10)
)
/
Create table orderdetail
(
ordernum VARCHAR2(17),
product_code VARCHAR2(17),
productdesc VARCHAR2(50),
barcode VARCHAR2(17),
color VARCHAR2(17),
qty number(10)
)
/
Insert into orderinfo values ('OR12345','TATA','MUMBAI','CAIRO',To_Date('21/06/2013','dd/mm/yyyy'), To_Date('27/07/2013','dd/mm/yyyy'),'5025',10000 );
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','1234567890','RED',500);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','1234567890','BLUE',500);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','7890123456','GREEN',1000);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','6789012345','YELLOW',1000);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','5678901234','ORANGE',1000);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','4567890123','PINK',1000);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','3456789012','BROWN',1000);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','2345678901','GREY',2500);
Insert into orderdetail values ('OR12345','5025','METALIC CLIPS','2345678901','SILVER',1500);
COMMIT
/
Output Required
Ordernum supplier productdesc barcode color qty etd eta pol pod
-------------------------------------------------------------------------------------------------------------------------------------
OR12345 TATA METALIC CLIPS 1234567890 RED || BLUE 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 7890123456 GREEN 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 6789012345 YELLOW 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 5678901234 ORANGE 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 4567890123 PINK 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 3456789012 BROWN 1000 21/06/2013 27/07/2013 MUMBAI CAIRO
OR12345 TATA METALIC CLIPS 2345678901 GREY || SILVER 4000 21/06/2013 27/07/2013 MUMBAI CAIRO
+++++++++++++++++++++++++++++++++++
如果有重复的条形码,则连接颜色并总结数量......这可以通过 oracle 中的 sql 查询来实现......任何帮助将不胜感激