Re: Join three fields into one on same table - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Join three fields into one on same table
Date
Msg-id dcc563d10805191436p6da8a088j5514156223f5bcb5@mail.gmail.com
Whole thread Raw
In response to Join three fields into one on same table  (jrivero <godsea@gmail.com>)
Responses Re: Join three fields into one on same table  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
On Mon, May 19, 2008 at 4:51 AM, jrivero <godsea@gmail.com> wrote:
> Hi, i need help for a query. I have three fields, year, month and day
> into table and need join and update another field named date on same
> table.
>
> My problem is not that make update query.
>
> With this query have the value of the update:
>> select year || '-' || month || '-' || day || ' 01:00:00' as newdate from table
>
> but this another query not have correct syntax...
>> update table set date=(select year || '-' || month || '-' || day || ' 01:00:00' as newdate from table)

Cast the output of those concatenations to date:

update table set date=(select (year || '-' || month || '-' || day || '
01:00:00')::date as newdate from table)

Does that help?

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: Join three fields into one on same table
Next
From: Sam Mason
Date:
Subject: Re: Join three fields into one on same table