Received: from send103.yahoomail.com (send103.yahoomail.com [205.180.60.92]) by hub.org (8.9.2/8.9.1) with SMTP id LAA81937 for ; Wed, 17 Mar 1999 11:04:22 -0500 (EST) (envelope-from mvca@yahoo.com) Message-ID: <19990317153335.4238.rocketmail@send103.yahoomail.com> Received: from [194.243.123.134] by send103.yahoomail.com; Wed, 17 Mar 1999 07:33:35 PST Date: Wed, 17 Mar 1999 07:33:35 -0800 (PST) From: Angelo CONFLITTI Subject: Problems with OUTER JOIN - UNION ... and so on .. To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii hi, I have some problems with the OUTER JOIN. I have 2 tables: The first TABELLA1 NAME | COD ------------+----- PIPPO |1AA PLUTO |2AB TOPOLINO |3AC PAPERINO |7BB PAPERONE |CC2 the second TABELLA2 COD | COUNTRY ----+------------- 1AA |ITALY 2AB |GERMANY CC2 |SWEDEN I want this query result: NAME | COD | COUNTRY ------------+------+-------------- PIPPO |1AA |ITALY PLUTO |2AB |GERMANY TOPOLINO |3AC | PAPERINO |7BB | PAPERONE |CC2 |SWEDEN I tried some queries but with bad results! The command OUTER JOIN (or equivalent) isn't in PostgreSQL (It's true?). One of my tries is: ------------------------------- SELECT a.name, a.cod, b.country FROM tabella1 a, tabella2 b WHERE a.cod = b.cod UNION SELECT a.name, a.cod, '' FROM tabella1 a; ------------------------------- but I have an error with the program "psql": "pqReadData() -- backend closed the channel unexpectedly. ......." and the psql terminate his execution. The query of example is right? There is another way? If I have 3 tables can I use more UNION? If I want an order by a column where can I write the "ORDER BY" command? (the last) with the UNION, I think, I'll have more equal rows: where I can write the "GROUP BY" command? Excuse for my english language and thank for any help. Angelo CONFLITTI. _________________________________________________________ DO YOU YAHOO!? Get your free @yahoo.com address at http://mail.yahoo.com