Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Query - Full Join

Avatar of holemania
holemania asked on
SQL
2 Comments1 Solution399 ViewsLast Modified:
Hello experts,

I have a simple query that I can't seem to get it to work correctly.  I have a table that has just one field call "CODE".  This is query between 3 databases, so I need to be able to order them in sequence and have it ouput side by side.  All 3 databases has same table and 1 field call "CODE".

Example:

DB1          DB2            DB3
AAB1         AAB1          AAB1
BB32         NULL          BB32
CDB4         NULL          NULL
NULL         NULL          DDEF3
JJL12          JJL12           NULL

I  tried the following, but can't seem to sort correctly.

SELECT D1.CODE AS DB1, D2.CODE AS DB2, D3.CODE AS DB3
FROM  DB1.DBO.PRODUCT D1 FULL OUTER JOIN DB2.DBO.PRODUCT D2
            ON D1.CODE = D2.CODE FULL OUTER JOIN DB3.DBO.PRODUCT D3
             ON D2.CODE = D3.CODE OR D1.CODE = D3.CODE
ASKER CERTIFIED SOLUTION
Avatar of harfang
harfangFlag of Switzerland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers