如何基于表的值添加别名

时间:2019-06-20 09:50:32

标签: oracle alias oracle12c

作为标题,例如我有一个表A,它的值从1到10。

我想选择值1和2作为“第一”列名称,选择值3和4作为“第二”列名称v.v。

看起来像这样:

Starting ChromeDriver 75.0.3770.8 (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40}) on port 13969
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1561022833.301][SEVERE]: bind() failed: Cannot assign requested address (99)

谢谢!

1 个答案:

答案 0 :(得分:0)

也许使用CASE

SQL> with test as
  2    (select level val from dual
  3     connect by level <= 5
  4    )
  5  select case when val <= 2 then val end first,
  6         case when val  > 2 then val end second
  7  from test;

     FIRST     SECOND
---------- ----------
         1
         2
                    3
                    4
                    5

SQL>

但是,如果您提供了示例数据并解释了如何处理(1、2、3、4)中未包含的值,这将有所帮助。