Received: from primaire.intelcom.fr (primaire.intelcom.fr [194.250.33.1]) by hub.org (8.10.1/8.10.1) with ESMTP id e8DFwRs42529 for ; Wed, 13 Sep 2000 11:58:27 -0400 (EDT) Received: from volvo.intelcom.fr ([192.168.160.20]) by primaire.intelcom.fr (8.8.8+Sun/8.8.8) with SMTP id RAA19218; Wed, 13 Sep 2000 17:58:10 +0200 (MET DST) Received: from intelcom.fr by volvo.intelcom.fr (SMI-8.6/SMI-SVR4) id RAA02614; Wed, 13 Sep 2000 17:58:06 +0200 Message-ID: <39BFA40D.176D3FC@intelcom.fr> Date: Wed, 13 Sep 2000 17:58:05 +0200 From: Jerome Raupach X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.5 sun4d) X-Accept-Language: en MIME-Version: 1.0 To: Ian Turner CC: pgsql-sql@postgresql.org Subject: Re: work on some tables in the same time. References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200009/91 Thanks, but: testdb=#CREATE VIEW tableselecttemp AS SELECT DISTINCT f1, f2, f3 FROM table1_n; ERROR: DISTINCT not supported in views Jerome. Ian Turner wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I want to execute this query on some table2 in the same time : > > > > INSERT INTO table2_n(f1, f2, f3) > > SELECT DISTINCT f1, f2, f3 FROM table1_n ; > > One way would be to do: > BEGIN > CREATE VIEW tableselecttemp AS > SELECT DISTINCT f1, f2, f3 FROM table1_n; > INSERT INTO table2_n(f1, f2, f3) SELECT * FROM tableselecttemp; > INSERT INTO table2 (f1, f2, f3) SELECT * FROM tableselecttemp; > DROP VIEW tableselecttemp; > ROLLBACK; > > Alternatively, run the select query twice without the temporary > view. You'll have to try it both ways, on a realistic data set, to see > which is faster for you. > > Ian > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.1 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE5v6HGfn9ub9ZE1xoRAuo0AJwNCXhjE4WWH0WMeZrLZCjrR/H37ACZAR4N > FkuWQ4rEUUMI6bCcZkCU3XA= > =q6gb > -----END PGP SIGNATURE-----