Re: Calculation of per Capita on-the-fly - problems with SQL syntax

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: Calculation of per Capita on-the-fly - problems with SQL syntax
Дата
Msg-id 20071015161935.GB10098@samason.me.uk
обсуждение исходный текст
Ответ на Re: Calculation of per Capita on-the-fly - problems with SQL syntax  (Stefan Schwarzer <stefan.schwarzer@grid.unep.ch>)
Список pgsql-general
On Mon, Oct 15, 2007 at 02:08:24PM +0200, Stefan Schwarzer wrote:
> Just one thing: As my year columns can have as well values like "1970-75",
> they are not integers, but text fields. Thus, the "IN" parameter in the
> "WHERE" clause doesn't work. Do you have any other idea how ti could work?

I'd be tempted to split your "year" column (maybe more appropriately
named as "year range") into two integer columns, one for the start year
and one for the end year.  Once you've done that it would become much
easier to write queries.  Generally, you want to split the information
that the database uses into one piece per column.  If you do split it
then you could do something like:

  WHERE d.year_min <= 2004 AND d.year_max >= 2002


  Sam

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

Предыдущее
От: "Trevor Talbot"
Дата:
Сообщение: Re: atomic commit;begin for long running transactions , in combination with savepoint.
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Calculation of per Capita on-the-fly - problems with SQL syntax