Re: date question

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: date question
Дата
Msg-id 20030622113559.GA10247@wolff.to
обсуждение исходный текст
Ответ на Re: date question  (javier garcia - CEBAS <rn001@cebas.csic.es>)
Список pgsql-sql
On Fri, Jun 20, 2003 at 19:33:35 +0200, javier garcia - CEBAS <rn001@cebas.csic.es> wrote:
> Hi all;
> 
> Peter, thank you very much for your help. Just a little thing. I've done as 
> you say:
> 
> CREATE TABLE rain_series_dated AS SELECT (year * interval '1 year' + month * 
> interval '1 month' + day * interval '1 day') AS 
> fecha,est7237,est7238,est7239,est7250 FROM rain_series ORDER by fecha;

It would probably be better to use a view instead of copying the data
to another table. That way you don't need to worry about the data
getting out of sync.

> And I've tried to use this result to be compared with my other table in which 
> "fecha" is "date" type. The result is that the query halts with no result; I 
> guess that it is because it tries to compare different data types.

It wouldn't be because of trying to compare a date and an interval.
You would get an error message instead.

> Is it possible to cast the "interval" obtained type into a "date" one in the 
> creation of the mentioned table?  (I've looked it in the documentation, but I 
> can't find the answer)

Not really. You could add the interval values to a base date, but that may
or may not make sense depending on your application.


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

Предыдущее
От: Paul Thomas
Дата:
Сообщение: Re: Delete duplicates
Следующее
От:
Дата:
Сообщение: Informing end-user of check constraint rules