Re: Help with a view

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Help with a view
Date: 2005-09-22 18:12:15
Message-ID: 200509222012.15463.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thursday 22 September 2005 20:03, Dmitri Bichko wrote:

> SELECT * FROM principals WHERE event = 15821 AND person != 2?

Sure, that's a concise answer to what I actually wrote, but it wasn't
exactly what I intended :)

Basically, what I've got is the first person and the tag_type. I can do
it with a function from PHP:

function get_spouses($p) {
$handle = pg_query("select person from principals
where event in (select event from principals
where person = $p and tag_type = " .MARR. ")
order by sort_date");
$i=0;
$spouses = array();
while ($row = pg_fetch_row($handle) {
if $row[0] != $p
$spouses[$i++] = $row[0];
}
return $spouses;
}

But this is *ugly* ...
--
Leif Biberg Kristensen
http://solumslekt.org/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitri Bichko 2005-09-22 19:10:42 Re: Help with a view
Previous Message Dmitri Bichko 2005-09-22 18:03:40 Re: Help with a view