2
Would anyone know if there is an error in the query below:
select name, cast(Extract(day from payday) as int) as 'day' from loan;
I cannot find the reason for a build error in the URI.
2
Would anyone know if there is an error in the query below:
select name, cast(Extract(day from payday) as int) as 'day' from loan;
I cannot find the reason for a build error in the URI.
3
I thought the problem would be in cast; went to create this fiddle and I realized the error message (42601: syntax error at or near "'day'") is related to alias, not to the extract
.
Removing the quotes, the problem is solved:
select name, cast(Extract(day from payday) as int) as day from loan;
You can name with double quotes, and not with single quotes (apostrophe): "Day".
Browser other questions tagged sql postgresql
You are not signed in. Login or sign up in order to post.
Swap 'day' for "day". The first is a string and the second is a delimited identifier (or quoted).
– anonimo