Re: Join three fields into one on same table

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Join three fields into one on same table
Дата
Msg-id 20080520000430.GF27988@frubble.xen.chris-lamb.co.uk
обсуждение исходный текст
Ответ на Re: Join three fields into one on same table  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Ответы Re: Join three fields into one on same table
Список pgsql-general
On Mon, May 19, 2008 at 03:36:39PM -0600, Scott Marlowe wrote:
> On Mon, May 19, 2008 at 4:51 AM, jrivero <godsea@gmail.com> wrote:
> > My problem is not that make update query.
> >
> >> 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)

I'd guess the OP doesn't want the sub-query, if he posted the error
message we'd know for sure.  I'd guess something like:

  update table set date=(year||'-'||month||'-'||day||'01:00:00')::date;

If the "date" column really is of date type, then the final
"||'01:00:00'" is somewhat superfluous.


  Sam

В списке pgsql-general по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Join three fields into one on same table
Следующее
От: Dragan Zubac
Дата:
Сообщение: Re: Vacuuming on heavily changed databases