INSERT INTO table3 (id, surname, dt) SELECT table1.id, table1.surname, table2.dt FROM table1, table2;
or
CREATE TABLE table3 AS SELECT table1.id, table1.surname, table2.dt FROM table1, table2;
It's called a cross-join.
Cheers...
MikeA
-----Original Message-----
From: Mikhail V. Majorov [mailto:mik@ttn.ru]
Sent: 14 February 2001 14:49
To: pgsql-general@postgresql.org
Subject: [GENERAL] very simple: How can I multiply tables?
Hi, question
How can I multiply tables using SELECT?
Table 1
id surname
--------------
1 AAA
2 BBB
3 CCC
4 DDD
Table 2
dt
---
12
35
RESULT
id surname dt
---------------------------
1 AAA 12
2 BBB 12
3 CCC 12
4 DDD 12
1 AAA 35
2 BBB 35
3 CCC 35
4 DDD 35
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
Nick West - Global Infrastructure Manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************