Search Postgresql Archives

Re: SELECT returnig a constant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2019 at 8:25 AM Geoff Winkless <pgsqladmin@xxxxxxxx> wrote:
On Tue, 15 Oct 2019 at 14:35, Ray O'Donnell <ray@xxxxxxxxxxxx> wrote:
>
> On 15/10/2019 14:28, stan wrote:
> > I used to be able to return a constant value in a SELECT statement in
> > ORACLE. I need to populate a table for testing, and I was going to do so
> > like this:
> >
> > SELECT
> >          employee.id ,
> >               project.proj_no ,
> >               work_type.type  ,
> >               'rate' 1
> > FROM employee
> > CROSS JOIN project
> > CROSS JOIN work_type;
> >
> > This statement works correctly, till I add the last " 'rate' 1 line, then it
> > returns a syntax error.

I would assume you have the value and the alias backwards and you want

SELECT 1 AS "rate"

Both the double quotes around the alias and the AS keyword are optional.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux