有一张表    temp ,只有一个列表  ID ;select  *  from  temp  会得到10
11
12
13如果想得到这样的数据,用 sql 语句可以实现么?
ID
10
11
12
13

解决方案 »

  1.   


    SQL> with t as(
      2       select 10 id from dual union all
      3       select 11 from dual union all
      4       select 12 from dual union all
      5       select 13 from dual
      6       )
      7  select 'id' col_id from dual
      8  union all
      9  select to_char(id) from t;COL_ID
    ----------------------------------------
    id
    10
    11
    12
    13
      

  2.   

    SELECT COLUMN_NAME  FROM  User_Col_Comments WHERE table_name='TEMP'
    UNION ALL
    SELECT ID FROM TEMP
      

  3.   

    实用是因为temp只有ID这个字段!呵呵