sql - What is the difference between these two queries(Using IN and JOIN)? -


i have find whatever matching records(npi) there in both. tried both below queries. both giving different results in count (say 12000 , 200000 respectively). between:

select * emblem_attested  npinumber in (select npinumber empire_attested) 

and

select * empire_attested emp join emblem_attested emb on emp.npinumber = emb.npinumber 

i don't know 1 correct.

the in clause give rows in emblem_attested have npinumber in empire_attested. if there records in emblem_attested same npinumber not affect result.

for example, if emblem_attested has npinumber of 1 , empire_arrested table has multiple records npinumber of 1. 1 record returned npinumber of 1.

the join give more record if there multiple records in emblem_attested same npinumber. if there duplicate npinumber in emblem_attested more records in results join. seeing.

with join, if emblem_attested has npinumber of 1 , empire_arrested table has multiple records npinumber of 1. multiple records returned join return record each record in empire_arrested npinumber of 1.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -