Re: Select statement

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: "dave go" <godave621(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select statement
Date: 2001-05-22 08:49:46
Message-ID: 009501c0e29c$280d26e0$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "dave go" <godave621(at)yahoo(dot)com>

> Hi,
>
> I am trying create a new table A from table B. On B
> (b1, b2, b3, b4 ) I would like create a table A (a1,
> a2, a3) where a2 is b2 and b3.

create table foo(a serial, b text);

select a, substr(b,1,strpos(b,' ')-1) as firstname, substr(b,strpos(b,'
')+1) as lastname into bar from foo;

will create a table bar. You will need to add your own sequences etc. later.

Note - CHECK YOUR NAMES FIRST - this will only work with exactly two names
separated by one space.

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-05-22 08:56:42 Re: Load balancing lots of simultaneous clients or queries?
Previous Message Dirk Lutzebaeck 2001-05-22 07:48:29 Load balancing lots of simultaneous clients or queries?