0

我面临一个非常讨厌的问题来创建报告。为此,我想将列数据作为列标题。

表: 技能表

SKILL_ID    |      NAME
3431060     |      Stomach
3431064     |      Hand
3437806     |      Finger

localnode_table(实际上具有技能表中名称的顺序/对齐方式(例如下一个和上一个)。

NODE_ID  |  PREVIOUS_ID  |  NEXT_ID
3431060  |               |  3431064
3431064  |    3431060    |  3437806
3437806  |    3431064     

如何使它看起来像:

Stomach |   Hand |   Finger
3431060 |  3431064 | 3437806
4

2 回答 2

0

This should work for your requirement,

SELECT
     ( SELECT SKILL_ID FROM skill_table WHERE  name = 'Stomach'),
     ( SELECT SKILL_ID FROM skill_table WHERE  name = 'Hand'),
     ( SELECT SKILL_ID FROM skill_table WHERE  name = 'Finger')
FROM dual       
    UNION ALL
SELECT
     ( SELECT NAME FROM skill_table WHERE  name  = 'Stomach'),
     ( SELECT NAME FROM skill_table WHERE  name  = 'Hand'),
     ( SELECT NAME FROM skill_table WHERE  name  = 'Finger')
FROM dual;
于 2012-05-02T11:02:19.460 回答