select from table and add rows.

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: select from table and add rows.
Date: 2007-07-06 13:25:08
Message-ID: 200707061425.09074.gary.stainburn@ringways.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi folks.

In PHP I often do things such as:

$wpartners=array('all'=>'All','sel'=>'Current','mine'=>'Mine');
foreach(
loadhash("select p_id as key, p_name as value
from partners order by p_name"
)
as $key=>$dets) {
$wpartners[$key]=$dets;
}

This sets up an array with some pseudo values and then populates it with
*proper* values from a table.

How's the best way to do this all within SQL.
--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bart Degryse 2007-07-06 14:14:34 Quote problem
Previous Message Ranieri Mazili 2007-07-05 20:49:29 Re: Working with dates