dumb question

Поиск
Список
Период
Сортировка
От Steve Clark
Тема dumb question
Дата
Msg-id 769c14bd-2a1d-b126-71dc-bf73e8395fe1@netwolves.com
обсуждение исходный текст
Ответы Re: dumb question  (Dann Corbit <DCorbit@connx.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 по дате отправления:

Предыдущее
От: Steve Clark
Дата:
Сообщение: Re: dumb question
Следующее
От: Dann Corbit
Дата:
Сообщение: Re: dumb question