Re: Join three fields into one on same table

From: jrivero <godsea(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Join three fields into one on same table
Date: 2008-06-02 09:39:30
Message-ID: d1b52fe3-6f9a-45ba-b329-ba1d84f987e0@25g2000hsx.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Very thanks Scott!! this is the solution was need :)

Jordi

On 19 mayo, 23:36, scott(dot)marl(dot)(dot)(dot)(at)gmail(dot)com ("Scott Marlowe") wrote:
> On Mon, May 19, 2008 at 4:51 AM,jrivero<god(dot)(dot)(dot)(at)gmail(dot)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?
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrej Ricnik-Bay 2008-06-02 09:45:03 Re: Bottom Posting
Previous Message Hermann Muster 2008-06-02 09:23:40 Accessing other databases with DBLink when leaving user/password empty