My frist post was not worded correctly. I cannot join two tables as all the rows are unique.

men

id
height
name
age
fav team


1 - 176cm - John - 25-lakers
2 - 180cm - Rob -  40-yankies


women

id
height
name
age
no_of_children

3 - 166cm - mary - 22 - 2
4 - 175cm - betty - 48 - 4


I want to display all the attributes of all the people even if they are null my final table should be


1 - 176cm - John - 25-null-lakers
2 - 180cm - Rob -  40-null-yankies
3 - 166cm - mary - 22 - 2-null
4 - 175cm - betty - 48 - 4-null




Ross

----- Original Message ----- From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <mysql@lists.mysql.com>
Sent: Tuesday, June 19, 2007 12:58 PM
Subject: RE: selecting everyting from 2 non-identical tables.


[snip]
I have two non-identical tables. They are pretty similar except a few
fields.  I want to select everything from both for example

table1

id
name
age


table2

id
name
height


I want

id
name
height
age


even if it returns null values. select * from table1, table2 seems to
give repeat rows for some reason.
[/snip]

Use a left outer join, assuming that 'name' is the same in both;

SELECT t1.id, t1.name, t1.age, t2.height
FROM table1 t1 LEFT OUTER JOIN table2 t2
ON(t1.name = t2.name)



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to