Re: INSERT only under certain conditions (SELECT)

Поиск
Список
Период
Сортировка
От Joachim Trinkwitz
Тема Re: INSERT only under certain conditions (SELECT)
Дата
Msg-id 87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de
обсуждение исходный текст
Ответ на Re: INSERT only under certain conditions (SELECT)  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: INSERT only under certain conditions (SELECT)  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-sql
Maybe I should explain my problem a little bit: simplified, I have two
tables, L and T, (which values references to L):

L:
art|kvvnr|semester---+-----+--------7.0| 4151| 2002ws7.0| 4326| 2002ws6.1| 4200| 2002ws7.0| 4151| 2001ws

(combination of kvvnr and semester is unique)

T:
 id |semester|kvvnr----+--------+----- 123| 2002ws |4151 123| 2001ws |4151

Now I want to allow a user with id 123 only to insert a row in T if he
doesn't choose values from L with same 'art' and 'semester' values --
in the examples user 123 has already chosen a kvvnr from semester
2002ws in category 'art', so he shouldn't be allowed to insert the
values of the second row in table L.

I hope, someone has followed this complicated thing up to here and
there is a solution for my problem.

Greetings and thanks for your answers by now and further on,
joachim




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

Предыдущее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: Bad SUM result
Следующее
От: Roberto Mello
Дата:
Сообщение: Re: manipulating the database in plsql