How to select several hardcoded SQL rows?

前端 未结 8 1605
囚心锁ツ
囚心锁ツ 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:06

    In MySQL you could use UNION like this:

    SELECT * from 
        (SELECT 2006 AS year UNION
         SELECT 2007 AS year UNION
         SELECT 2008 AS year UNION
        ) AS years
    

提交回复
热议问题