Need a sample Postgre SQL script - Mailing list pgsql-sql

From Dhanushka Samarakoon
Subject Need a sample Postgre SQL script
Date
Msg-id 93e317cd0807010731o7655a1d5j76c6bb2482cea910@mail.gmail.com
Whole thread Raw
Responses Re: Need a sample Postgre SQL script  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Hi All,<br /><br />I'm kind of new to Postgre and I need some advice.<br />I have the following table.<br />metadata
(value:integer, field:integer , mydate:text)<br /><br />given below is a sample record from that.<br />( 2 , 16 ,
Augest2009)<br /><br />I need a script that will read the above table and for each such row it will insert two rows as
below.<br/><br />( 2 , 91 , Augest )<br />( 2 , 86 , 2009 )<br /><br />16, 91 and 86 are static values. <u>value and
fieldtogether</u> creates the primary key.<br /><br />I could figure out and write the logic for this. I only need a
littlebit similar sample script so that I can figure out Postgre syntax.<br />Like <br />- Loop syntax to through all
therows return by a select *<br />- How to assign that value to a parameter<br /> - using that parameter in the Insert
statement<br/>- etc ...<br /><br />Thanks,<br />Dhanushka.<br /><br /> 

pgsql-sql by date:

Previous
From: Gary Stainburn
Date:
Subject: Re: Quick select, slow update - help with performance problems
Next
From: Richard Huxton
Date:
Subject: Re: Need a sample Postgre SQL script