dumb question - Mailing list pgsql-general

From Steve Clark
Subject dumb question
Date
Msg-id 769c14bd-2a1d-b126-71dc-bf73e8395fe1@netwolves.com
Whole thread Raw
Responses Re: dumb question  (Dann Corbit <DCorbit@connx.com>)
List 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 by date:

Previous
From: Steve Clark
Date:
Subject: Re: dumb question
Next
From: Dann Corbit
Date:
Subject: Re: dumb question