pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Graham Leggett <minfrin@sharp.fm>
To: pgsql-sql@postgresql.org
Subject: Normalising an existing table - how?
Date: Thu, 24 Jun 2004 20:51:08 +0200
Message-ID: <40DB229C.9040306@sharp.fm> (raw)

Hi all,

I have an existing table containing a column in it containing a money 
value. I would like to normalise this column into a separate table, as 
the money value is to be expanded to contain a tax value, etc.

I have been trying to find a SQL query that will do the following:

- Select the money column from the table
- Populate the new normalised table with each row containing the value 
from the original money column
- Write the primary keys of the new rows in the normalised table, back 
to a new column in the original table added for this purpose.

This third step I am struggling with - can anyone suggest a query that 
might achieve the writing back of the primary key to the original table?

Regards,
Graham
--



view thread (9+ messages)  latest in thread

Message-ID: <40DB229C.9040306@sharp.fm>
Permalink:  ../40DB229C.9040306@sharp.fm/
Also on:    postgresql.org/message-id/40DB229C.9040306@sharp.fm

 · 

reply

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: minfrin@sharp.fm
  Subject: Re: Normalising an existing table - how?
  In-Reply-To: <40DB229C.9040306@sharp.fm>

* 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