lyric0n
Technical User
- Dec 28, 2005
- 74
Hello, I have the following data and I need to have the result listed below, but when I try to use case statements, it fails. Could someone take a look and see if they can see what I am doing wrong?
Table1
IDKey
1
2
3
4
Table2
IDKey | Name
1 | John
2 | Jane
Table3
IDKey | Name
3 | Joe
4 | Sally
Result
IDKey | Name
1 | John
2 | Jane
3 | Joe
4 | Sally
SELECT Table1.IDKey,
CASE Table2.Name
WHEN IS NULL THEN Table3.Name
END AS IDKeyName
FROM Table1 LEFT OUTER JOIN Table1.IDKey = Table3.IDKey LEFT
OUTER JOIN Table2.IDKEY ON Table1.IDKey = Table2.IDKey
Thanks, Chris
Table1
IDKey
1
2
3
4
Table2
IDKey | Name
1 | John
2 | Jane
Table3
IDKey | Name
3 | Joe
4 | Sally
Result
IDKey | Name
1 | John
2 | Jane
3 | Joe
4 | Sally
SELECT Table1.IDKey,
CASE Table2.Name
WHEN IS NULL THEN Table3.Name
END AS IDKeyName
FROM Table1 LEFT OUTER JOIN Table1.IDKey = Table3.IDKey LEFT
OUTER JOIN Table2.IDKEY ON Table1.IDKey = Table2.IDKey
Thanks, Chris