Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
JP_xpto
Starting Member
10 Posts |
Posted - 2002-11-08 : 06:10:52
|
| Please consider this 2 tables:TAB01----------------Account1 Value1----------------5551 * 605552 * 805554 * 4TAB02--------------------------Account2 Value2 Cod--------------------------5551 * 62 * bv5553 * 1 * vpThe objective is to get a view like this:Accounts Value1 Value2--------------------------5551 * 60 * 625552 * 80 * null 5553 * null * 15554 * 4 * nullI cant get this done ...any ideias? |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-11-08 : 06:16:22
|
| SELECT COALESCE(Account1, Account2) AS Accounts, Value1, Value2FROM TAB01FULL OUTER JOIN TAB02 ON Account1 = Account2 |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2002-11-08 : 06:21:38
|
| select c.account1, d.value1, e.value2from (select a.account1 from table1 aunionselect b.account2 from table2 b) cleft join table1 d on d.account1 = c.account1left join table2 e on e.account2 = c.account1order by 1??? |
 |
|
|
|
|
|