dumb question

From: Steve Clark <steve(dot)clark(at)netwolves(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: dumb question
Date: 2016-06-02 17:16:06
Message-ID: 7f05ed1b-c150-a098-619f-a7b7b5e4e2ca@netwolves.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

--

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2016-06-02 17:23:20 Re: dumb question
Previous Message Steve Clark 2016-06-02 16:56:14 dumb question