Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 535039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:40:29+00:00 2026-05-13T09:40:29+00:00

I got a little problem. I’m using Full outer Join in Sql server –

  • 0

I got a little problem.

I’m using Full outer Join in Sql server – so far it works
but now I add a table and it doesn’t work as it should.

Here is my code:

SELECT *
FROM Table1 h , (db1..Table2 s FULL OUTER JOIN  db1..Table3 k
on k.attributT3_1 = s.attributT2_1 
    and left(k.attributT3_2,4) = year(s.attributT2_2)
    and substring(k.attributT3_2,6,1) = s.attributT2_2
    and (case when k.attributT3_3 = 0 and k.attributT3_4 = 11 then 10 
        when k.attributT3_3 = 0 and k.attributT3_4 = 14 then 40
        when k.attributT3_3 = 0 and k.attributT3_4 = 16 then 60 
        when k.attributT3_3 = 0 and k.attributT3_4 = 90 then 10 
        when k.attributT3_3 = 1 and k.attributT3_4 = 11 then 11 
        when k.attributT3_3 = 2 and k.attributT3_4 = 11 then 12 
        when k.attributT3_3 = 4 and k.attributT3_4 = 11 then 14 
        when k.attributT3_3 = 7 and k.attributT3_4 = 11 then 17 
        else k.attributT3_3 end) = s.attributT2_3) 
where h.attributT1_1 = k.attributT3_1 
and s.attributT3_1 = '  260585'
and h.attributT1_2 = 055

That’s my SQL, may be a little bit confusing^^

My problem here is FULL OUTER JOIN doesn’t work because I added Table1, because there are some infos I need and now FULL OUTER JOIN works like LEFT OUTER JOIN.

It is also possible that I need to add one or 2 more Tables in this FULL OUTER JOIN.

Does anyone have an idea how I could get it to work?
(and yeah I know I could use 2 left outer joins and an union and make it work but that’s not what I want to do)

btw the script sould work on oracle too 😀

the output should be like this:
http://img402.imageshack.us/img402/4618/bildwq.jpg

Column1 = Table1
Column2 = Table2
Column3 = Table3

the null values do not exist on the table

my script does the same except u cant see the rows in column 2 with nulls

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:40:29+00:00Added an answer on May 13, 2026 at 9:40 am

    The WHERE clause is restricting the results that can be returned:

    where h.attributT1_1 = k.attributT3_1 
    and s.attributT3_1 = '  260585'
    and h.attributT1_2 = 055
    

    This means that only results where tables H, K and S have contributed a row (not nulls) will be shown. Effectively you have removed the OUTER from the join. Try moving those conditions into the join definitions.

    An example to show what I mean:

    SQL> create table t1 (id integer, text varchar2(10));
    SQL> create table t2 (id integer, text varchar2(10));
    SQL> insert into t1 values (1, 'text');
    SQL> insert into t1 values (2, 'text');
    SQL> insert into t2 values (2, 'text');
    SQL> insert into t2 values (3, 'text');
    SQL> commit;
    

    A full outer join:

    SQL> select * from t1 full outer join t2 on t1.id = t2.id;
    
            ID TEXT               ID TEXT
    ---------- ---------- ---------- ----------
             2 text                2 text
                                   3 text
             1 text
    

    Now with filters in the WHERE clause (note that 2 records disappear just as if the “full outer” wasn’t there):

      1* select * from t1 full outer join t2 on t1.id = t2.id
      2* where t1.text='text'
      3  and t2.text='text';
    
            ID TEXT               ID TEXT
    ---------- ---------- ---------- ----------
             2 text                2 text
    

    Now with the filters moved into the join:

    SQL> select * from t1 full outer join t2 on t1.id = t2.id
      2                                      and t1.text='text'
      3                                      and t2.text='text';
    
            ID TEXT               ID TEXT
    ---------- ---------- ---------- ----------
             2 text                2 text
                                   3 text
             1 text             
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a little problem, it seems simple (personally I think it is), but
I've got a little problem using WPF Dispatcher Timer. On each timer tick my
Got a little problem i asked about it before but maybe i didnt ask
Got a little problem in my code, the query works fine if I manually
I got a little problem i need a sql query that gives all rows
I've got a little problem on a goDaddy server. I have a php script
I got a little problem, what I think, can't be hard. but somehow, I
I've got a little problem. my application runs without problems in Debug mode, but
I have got a little problem using the CodeIgniter route function. I use the
I want to using gpg in windows batch scripts and i've got little problem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.