Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you do a full outer join in sqlserver 2005?

How can you do a full outer join in sqlserver 2005?

Seems like there is full outer join in sqlserver 2008 but I need to do this in sqlserver 2005.

In other words, I am merging two views based on the ACCTNUM col in both views (The views show aggregates so there is at most one ACCTNUM record in each view for each account) and I would like every record in each table to show up, even when there is no match in the other (ie, full outer join).

like image 657
Lill Lansey Avatar asked Apr 22 '26 22:04

Lill Lansey


1 Answers

This will work in SQL 2005

Select
    tableA.Column,
    tableA.AnotherColumn,
    tableB.Column
From
    tableA
Full Outer Join
    tableB On tableA.Id = tableB.Id

Note you can use Full Join or Full Outer Join, it doesnt make a difference.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!