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 |
|
pfdtv
Starting Member
10 Posts |
Posted - 2008-08-07 : 14:38:53
|
| Hi,I am using MS SQL Server 2005 Express.I aim to join two derived tables, each with the columns, "ticket" (unique), "summary", "description". Each table also contains a "rank" column, where the ticket is ranked by relevancy. Some tickets may appear on only one of the derived tables, while others appear on both. My goal is to join these two tables such that each ticket,summary,descrption is paired with the sum of these two ranks. When I try to outer join these tables, adding a rank with NULL provides NULL, and I don't know how to get around this.Thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-07 : 14:43:40
|
| select coalesce(t1.ticket,t2.ticket), coalesce(t1.summary,t2.summary), coalesce(t1.description,t2.description), coalesce(t1.rank,0) + coalesce(t2.rank,0)from firstderivedtable t1full outer join seconddervedtable t2on t1.ticket=t2.ticket |
 |
|
|
pfdtv
Starting Member
10 Posts |
Posted - 2008-08-07 : 15:05:24
|
| Perfect, exactly what I was looking for.Thanks! |
 |
|
|
|
|
|
|
|