This is a discussion on Using FULL OUTER JOIN within the Database Support forums, part of the Web Development category; Hi all, Can someone specify the situation at when to use FULL OUTER JOIN in a query?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi, A common situation where you need to "merge" the data from two tables, and rows may or may not exist in either table. For example, suppose we have budgets in one table and actuals in another and we wish to present them side by side. Many people would use a FULL OUTER JOIN to accomplish this, perhaps writing something like this: SELECT coalesce(a.company,b.company) as company, coalesce(a.account, b.account) as account, coalesce(a.year,b.year) as year, coalesce(a.month, b.month) as month, coalesce(a.amount,0) as Actual, coalesce(b.amount,0) as Budget FROM Actuals a FULL OUTER JOIN Budgets b on a.company = b.company and a.account = b.account and a.year = b.year and a.month = b.month The above FULL OUTER JOIN will effectively "merge" the two tables and allow you to see all actuals and budgets for every company/account/year/month, and it will show values from either table even if there is not a matching value in the other table. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Index Full Hard Disk | llowlene_discuss_me | Introductions | 8 | 10-09-2008 08:50 PM |
| thanks, glad to join up | stevorama | Introductions | 0 | 03-02-2008 10:02 AM |
| Limitation In Join | prasath | Database Support | 1 | 09-14-2007 05:38 AM |
| Full duplex audio conversation in .NET | kingmaker | C# Programming | 0 | 07-19-2007 10:44 PM |
| Full duplex audio conversation in .NET | kingmaker | C# Programming | 0 | 07-18-2007 10:36 PM |