From: Leif B. Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re: Help with a view
Date: Thu, 22 Sep 2005 20:12:15 +0200
Message-ID: <200509222012.15463.leif@solumslekt.org> (raw)
In-Reply-To: <F18A6F7CF1661F46920F2CF713122FED46CCAD@mail.aveo.aveopharma.com>
References: <F18A6F7CF1661F46920F2CF713122FED46CCAD@mail.aveo.aveopharma.com>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: leif@solumslekt.org
Subject: Re: Help with a view
In-Reply-To: <200509222012.15463.leif@solumslekt.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox