Re: To get a Table or View like a Calendar with dates

Поиск
Список
Период
Сортировка
От Csanyi Pal
Тема Re: To get a Table or View like a Calendar with dates
Дата
Msg-id 87wr0zor59.fsf@gmail.com
обсуждение исходный текст
Ответ на To get a Table or View like a Calendar with dates  (Csanyi Pal <csanyipal@gmail.com>)
Ответы Re: To get a Table or View like a Calendar with dates  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-novice
Hi Kevin,

"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:

> Csanyi Pal <csanyipal@gmail.com> wrote:
>
>> The database should store the data like dates of the beginning and
>> the end of the school year, holidays, non school days, various
>> events, etc.
>>
>> I want to get a Table or a View which I can use as a School
>> Calendar with school days, and non school days too, and much more.
>>
>> I have created Tables with dates of the beginning date and the end
>> date of the school year.
>>
>> I have Table with dates of holidays and/or non school days in the
>> school year too.
>>
>> Can I create a Table or a View from these Tables to get such a
>> school calendar?
>
> Yes, it sounds like the set of tables you describe could support a
> great many useful queries, and you could encapsulate these in views
> to make them easier to use.

I have amongs other two tables:
felevek_kezdetei_1_8 and
felev1_vege_tan_nap_1_8

iskolanaptar_201213=# set search_path to félévek_negyedévek;
SET

The first table contains the ordinal number of the semester (1 or 2) and
the start dates of the same:

iskolanaptar_201213=# select * from felevek_kezdetei_1_8;
 felev1v2 |   datum
----------+------------
 1        | 2012-09-03
 2        | 2013-01-15
(2 rows)

The second table contains the end date of the first semester and the
number of the days in this semester:

iskolanaptar_201213=# select * from felev1_vege_tan_nap_1_8;
   datum    | ennyi_tan_nap
------------+---------------
 2012-12-21 |            78
(1 row)

So I'm trying as a beginning to create the 'felev_1_napjai' view that
should display only the first and the end date of the first semester:

iskolanaptar_201213=# create or replace view felev_1_napjai as select
datum from felevek_kezdetei_1_8, felev1_vege_tan_nap_1_8 where
felevek_kezdetei_1_8.felev1v2 = '1';
ERROR:  column reference "datum" is ambiguous
LINE 1: create or replace view felev_1_napjai as select datum from f
                                                        ^
> Are you having some problem doing so?  What have you tried?  What
> did you expect to happen?  What happened instead?

As you can see above I get error message.

If I success in this I shall modify this view so so I get a view of
dates between the start and the end date of the first semester. I shall
to use the generate_series somehow, but sofar I have no success.

--
Regards from Pal

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

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: how to get desired html format output?
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: To get a Table or View like a Calendar with dates