Skip to content
Advertisement

How to work left outer join in SQl Server?

First: I know to use all types of join but I don’t know why it works like this for this Query

I have a Scenario for making a SQL Query, by using 3 tables and a left outer join between selling and order items.

My Tables:

I want this output:

My SQL code:

Out put My Code

Why is my output 2x? or why does my output return 4 records?

Advertisement

Answer

Your result can be achieve with row_number:

Here is a demo

You can add more tables like this:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement