This is untested, but it might be enough to get you started:
SELECT namecounter
FROM name n
WHERE NOT EXISTS (
SELECT 1
FROM name
WHERE hh > 0
AND famnu = n.famnu
)
GROUP BY famnu
HAVING birthdate = min( birthdate );
What I'm trying to do here is grab all families th
On Sat, Oct 09, 2004 at 01:39:45PM -0700, Andrew Ward wrote:
>
> CREATE TABLE name (
> namecounter integer NOT NULL,
> firstmiddle character varying(64) NOT NULL,
> lastname character varying(64) NOT NULL,
> birthdate date,
> hh smallint,
> famnu integer,
> );
>
> Each row
On Sat, Oct 09, 2004 at 01:39:45PM -0700, Andrew Ward wrote:
>
> I'm running postgres 7.3.2 on linux, and making my
> requests from Perl scripts using DBD::Pg. My table
> structure is as follows (irrelevant cols removed)
>
> CREATE TABLE name (
> namecounter integer NOT NULL,
> firstmidd
I'm trying to figure out how to do a particular query,
and I'm beating my head against a wall. Here's my
situation:
I'm running postgres 7.3.2 on linux, and making my
requests from Perl scripts using DBD::Pg. My table
structure is as follows (irrelevant cols removed)
CREATE TABLE name (
nam