如何交换日期oracle



请给我一张类似的表格

customer_no   product_code
1345            001
1345            002
1345            003

我想要一张能显示这些详细信息的新表

customer_no  product_code, product_code
 1345          001             002
 1345          001             003
 1345          002             001
 1345          002             003
 1345          003             001
 1345          003             002

这将为您提供所需的输出。

create yourNewTableName as (
   select t1.customer_no,
          t1.product_code,
          t2.product_code
   from yourOldTableName t1
   inner join yourOldTableName t2
         on t1.customer_no = t2.customer_no
   where t1.product_code != t2.product_code
);

最新更新