This is what I did
select f.visits
from pls_fy2014_pupld14a pfpa as f
and I got:
SQL Error [42601]: ERROR: syntax error at or near "AS"
This case below is working but I don't get why I cannot use 'as'
select visits
from pls_fy2014_pupld14a pfpa
CodePudding user response:
Aliases always have to be put directly after the table or column name, so in your case:
SELECT pfpa.visits AS f
FROM pls_fy2014_pupld14a pfpa
CodePudding user response:
In your second query:
select visits
from pls_fy2014_pupld14a pfpa;
the pfpa
appearing after the table name is an alias. Note that we can only alias a table once in SQL. In your second query:
select f.visits
from pls_fy2014_pupld14a pfpa as f
you attempting to alias pfpa
a second time as f
. You can't do that.
CodePudding user response:
You are - probably - trying to alias the table twice. AS is not mandatory, so
SELECT pfpa.visits
FROM pls_fy2014_pupld14a pfpa
is the same as:
SELECT pfpa.visits
FROM pls_fy2014_pupld14a AS pfpa
You can not add another alias f