Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best practice: EXISTS vs COL_NAME in
Message
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01464472
Message ID:
01464503
Views:
22
>>No. INNER JOIN would select more than 1 record, in case of one-to-many. And forget about EXISTS for now. I am just trying to see why IN does not need the T1.PK_FLD = T2.PK_FLD in the subquery. For example, I used in my example columns that have the same name but there could be a case where columns have different names. For example:
>>
>>
>>select * from Table1 T! where COL1 in (select COL2 from Table2 T2 where COL3='123')
>>
>>
>>Would in the above case you still not use the T1.PK_FLD = T2.PK_FLD?
>
>I never would use T1.PK_FLD = T2.PK_FLD if I'm using IN subquery. The syntax of IN subquery doesn't ask for this and by trying to put it where you somehow complicate the whole process.

I will think about it.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform