I am getting different result set for these two queries and second result set seems to be correct. What is the difference in these queries.
What type of inner join q
SQL is a declarative language, and it's up to the DBMS to implement your query. The SQL Server query optimiser does not care whether you inner-join two tables using a JOIN
expression, a WHERE
expression, an IN
expression or an EXISTS
expression, internally they are all treated the same. SQL Server has 3 different internal join algorithms, which are selected only on the basis of row count and data distribution, not the exact syntax used to declare them. If you compare the execution plans of the two queries in your example you should find that they are identical, and will therefore produce the same resultset.