pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems with OUTER JOIN - UNION .....
2+ messages / 1 participants
[nested] [flat]

* Problems with OUTER JOIN - UNION .....
@ 1999-03-17 13:34  Angelo CONFLITTI <mvca@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Angelo CONFLITTI @ 1999-03-17 13:34 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Problems with OUTER JOIN - UNION ......
@ 1999-03-17 13:45  Angelo CONFLITTI <mvca@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Angelo CONFLITTI @ 1999-03-17 13:45 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1999-03-17 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-03-17 13:34 Problems with OUTER JOIN - UNION ..... Angelo CONFLITTI <mvca@yahoo.com>
1999-03-17 13:45 Problems with OUTER JOIN - UNION ...... Angelo CONFLITTI <mvca@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox