sqlite: alias column name can't contains a dot “.”

后端 未结 5 1908
渐次进展
渐次进展 2021-01-01 05:54

(sorry for my poor english)

If you try this select operation over a sqlite database:

SELECT column AS \'alias 1\' FROM table;

5条回答
  •  庸人自扰
    2021-01-01 06:21

    Enclose your alias in double quotes.

    SELECT 'test' AS "testing.this"
    

    Output:

    | testing.this |
      test
    

    Updated: Double quotes are used to enclose identifiers in SQL, not single quotes. Single quotes are only for strings. In this case you are trying to ensure that "testing.this" is used as is and not confused as testing.this (testing table this column).

    http://www.sqlite.org/faq.html#q24

提交回复
热议问题