How to select several hardcoded SQL rows?

前端 未结 8 1627
囚心锁ツ
囚心锁ツ 2020-12-28 11:55

If you execute this query

SELECT \'test-a1\' AS name1, \'test-a2\' AS name2

the result will be a one row-selection with two columns having

8条回答
  •  天命终不由人
    2020-12-28 12:21

    Extending the answer of @openshac for oracle, as the below mentioned code works for oracle:

    SELECT 'test-a1' AS name1, 'test-a2' AS name2 from dual 
    UNION ALL 
    SELECT 'test-b1', 'test-b2' from dual
    UNION ALL 
    SELECT 'test-c1', 'test-c2' from dual
    

提交回复
热议问题