• KWymore (3/21/2012)


    I had only looked at the ANY and SOME syntax once before and did not see a need for them. They seem to perform exactly like the IN statement unless I am missing something. Are there any instances where you could not perform the same logic using IN instead of ANY?

    You can use inequality comparisons with Any/Some. For example:

    SELECT *

    FROM ( VALUES ( 1), ( 2), ( 3) ) AS MyQuery (MyCol)

    WHERE MyCol > ANY ( SELECT MyCol2

    FROM ( VALUES ( 2), ( 3) ) AS MyQuery2 (MyCol2) ) ;

    Note the use of ">ANY". IN will only do equality comparisons.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon