Please advice on a query

Поиск
Список
Период
Сортировка
От JORGE MALDONADO
Тема Please advice on a query
Дата
Msg-id CAAY=A79xZ+pFsBmN7MdvwNEhZOd8=rY=ePo+X=Rp_XGqNC3xVg@mail.gmail.com
обсуждение исходный текст
Ответы Re: Please advice on a query  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-novice
I have a table more or less like this:

-----------------------------------------------------
crs_id                some data                req
-----------------------------------------------------
25                       aaaaaaaa                 21
25                       aaaaaaaa                 19
17                       ccccccccc                 null
8                         dddddddd                 null
19                       eeeeeeee                 15
19                       xxxxxxxxx                  37
15                       fffffffffffffffff                  10
10                       gggggggg                   null

I need to delete rows according to the following criteria:

* Row with "crs_id = 25" must be deleted (only the second row) because "req = 19" and there is a row with "crs_id = 19" 

* Row with "crs_id = 19" must be deleted (only the first row) because "req = 15" and there is a row with "crs_id = 15"

* Row with "crs_id = 15" must be deleted because "req = 10" and there is a row with "crs_id = 10"

I have been struggling with this issue without a successful result.

Respectfully,
Jorge Maldonado

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Type of text literals
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Please advice on a query