dumb question

Поиск
Список
Период
Сортировка
От Steve Clark
Тема dumb question
Дата
Msg-id 7f05ed1b-c150-a098-619f-a7b7b5e4e2ca@netwolves.com
обсуждение исходный текст
Ответы Re: dumb question  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: dumb question  (Steve Crawford <scrawford@pinpointresearch.com>)
Список pgsql-general
Hi List,

I am a noob trying to do something that seems like it should be easy but I can't figure it out.

I have a table like so:

id | ref_id | sts
------------------
1  |        |  0
2  | 1      |  1
3  |        |  0
4  |        |  0
5  | 4      |  1
6  |        |  0
7  | 6      |  1

I want to find the max(id) whose sts is 0 but whose id is not referenced by ref_id.

so the answer would be id=3.

Thanks for any pointers,
Steve

--



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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: Replication
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: dumb question