Re: Help with a view - Mailing list pgsql-sql

From Leif B. Kristensen
Subject Re: Help with a view
Date
Msg-id 200509222012.15463.leif@solumslekt.org
Whole thread Raw
In response to Re: Help with a view  ("Dmitri Bichko" <dbichko@aveopharma.com>)
Responses Re: Help with a view
List 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
(selectevent from principals                      where person = $p and tag_type = " .MARR. ")
orderby 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/


pgsql-sql by date:

Previous
From: "Dmitri Bichko"
Date:
Subject: Re: Help with a view
Next
From: Daryl Richter
Date:
Subject: Re: Updating cidr column with network operator