Question

Here's the code:

CREATE OR REPLACE VIEW skats_4 AS SELECT count(datums) AS 
2014_gada_pieteikumi from pieteikums where date_part('YEAR', 
datums)=2014;

I keep getting error with text "syntax error near 2014" (the "2014_gada_pieteikumi"). I don't see what is wrong.

Was it helpful?

Solution

Label should not to start by number. Use double quotes or rename label

postgres=# select 10 as 2014_some;
ERROR:  syntax error at or near "2014"
LINE 1: select 10 as 2014_some;
                     ^
Time: 0.647 ms
postgres=# select 10 as "2014_some";
 2014_some 
───────────
        10
(1 row)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top