Hi,
How to use inner join instead of left join
Well... how can you use -
instead of +
in order to get the sum of X+Y
?
It's about the same analogy
By the way, the answer is: X-(Y * (-1))
, but is this makes sense?
In this action we are calculating multiple operations (multiplication and subtraction ) instead of one. Moreover, a multiplication operation costs a lot more than a addition operation! behind the scenes multiplication is calculated as multiple times of an addition action.
i need to use inner join instead of left join because data is very big on table
This makes no sense. First of all you should let SQL Server find a good execution plan by itself. SQL Server is a very advance and complicated application and a lot of effort in the development was on adding advance algorithms and to make the server choose the right one according to the specific database and the statistics of the tables, which mean, that SQL Server should be able in most cases to choose the best solution according to the table size between other parameters
Moreover, INNER JOIN does not include all the information which LEFT JOIN returns, so you will need to bring the missing information probably and this mean more actions which most likely will cost more resources and perform worse.
With that said, in order to help you with best solution you should provide (at least) your Live Execution Plan (full XML and not just screenshot) and the exact structure of the relevant entities - queries to create the table and any existing index or constrain or foreign key and queries to insert some ample data