Search Postgresql Archives

Re: Join three fields into one on same table

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

 



On Mon, May 19, 2008 at 4:51 AM, jrivero <godsea@xxxxxxxxx> 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?


[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