|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Jay Blanchard (jblanchard
pocket.com)
Date: Thu Mar 06 2008 - 07:52:35 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[snip]
-----Original Message-----
From: roger.maynard [mailto:roger.maynard
crayford.ltd.uk]
Sent: Thursday, March 06, 2008 7:33 AM
To: mysql
lists.mysql.com
Subject: Im being dumb!
I got 4 tables:
Table A
| ID | Description1 |
Table B
| ID | Description2 |
Table C
| ID | Description3 |
Table D
| ID | Description4 |
ALL Ids ARE COMMON Values and NONE are MISSING
How can I create
| ID | Description 1 | Description 2 | Description 3 | Description 4 |
SELECT a.ID,a.Description1,b.Description2,c.Description3,d.Description4
FROM TableA a
INNER JOIN TableB b ON a.id = b.id
INNER JOIN TableC b ON a.id = c.id
INNER JOIN TableD b ON a.id = d.id
Doesn't give me the result
What am I doing wrong?
Can I do this?
[/snip]
Try this
SELECT a.ID, a.Description1, b.Description2, c.Description3,
d.Description4
FROM TableA a LEFT OUTER JOIN TableB b
ON a.ID = b.ID
LEFT OUTER JOIN TableC c
ON a.ID = c.ID
LEFT OUTER JOIN TableD d
ON a.ID = d.ID
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]