ITEM_CD

问题描述 投票:0回答:1

我有这样的数据。

| ITEM_CD |  CARACT_CD |   CARACT_VALUE     | DESCRIPTION |
|   1     |   A1       |   yyy              | descr1      |  
|   1     |   B1       |   xxx              | descr2      |  
|   2     |   A1       |   uuu              |             |  
|   2     |   B1       |   rrr              | descr3      |  
|   3     |   C1       |   kkk              |             |  

我想把数据表示为:

| ITEM_CD |    A1      |   A1_DS     |    B1    |    B1_DS       |    C1    |    C1_DS       | 
|   1     |   yyy      |   descr1    |    xxx   |    descr2      |          |                |  
|   2     |   uuu      |             |    rrr   |    descr3      |          |                |  
|   3     |            |             |          |                |    kkk   |                |  

谁能帮我在Oracle中使用PIVOT函数写出正确的查询?

非常感谢!

sql oracle pivot oracle12c
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.