Re: \copy combine with SELECT

From: Chris <dmagick(at)gmail(dot)com>
To: jia ding <dingjia(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: \copy combine with SELECT
Date: 2006-03-15 23:33:47
Message-ID: 4418A45B.5050200@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jia ding wrote:
> Hi all,
>
> I tried:
> select id, name into table2 from table1;
> \copy table2 to filename.txt
> in order to export 2 columns from table1 to a file.
>
> But, I am thinking, if there is a command can combine these two command
> together?
> Maybe, something like: \copy select id,name from table to filename.txt

Close.

copy tablename field1, field2 to 'filename';

http://www.postgresql.org/docs/8.1/static/sql-copy.html

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jaime Casanova 2006-03-15 23:34:23 Re: Concurrencia
Previous Message Jaime Casanova 2006-03-15 23:33:37 Re: [GENERAL] Concurrencia