March 20, 2012 at 11:44 pm
Nice and Easy Question. Thanks 😀
March 20, 2012 at 11:57 pm
Nice question, thanks.
Never use ANY or SOME though 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 21, 2012 at 2:15 am
Is there difference between SOME and ANY?
Can someone explain?
March 21, 2012 at 2:26 am
Carlo Romagnano (3/21/2012)
Is there difference between SOME and ANY?Can someone explain?
There is no difference. http://msdn.microsoft.com/en-us/library/ms175064.aspx:
SOME and ANY are equivalent.
March 21, 2012 at 2:41 am
Hi all,
Interesting questions...also the following query:
SELECT id
FROM dbo.SalesDates s
WHERE '2012/1/03' IN (SELECT saledate FROM SalesDates);
is equivalent to the one given in the QotD. If you try for the example dates, it produces the same results as with ANY and SOME.
(http://msdn.microsoft.com/en-us/library/ms177682.aspx)
Igor Micev,My blog: www.igormicev.com
March 21, 2012 at 2:41 am
Hi all,
Interesting questions...also the following query:
SELECT id
FROM dbo.SalesDates s
WHERE '2012/1/03' IN (SELECT saledate FROM SalesDates);
is equivalent to the one given in the QotD. If you try for the example dates, it produces the same results as with ANY and SOME.
(http://msdn.microsoft.com/en-us/library/ms177682.aspx)
Igor Micev,My blog: www.igormicev.com
March 21, 2012 at 2:41 am
Hi all,
Interesting questions...also the following query:
SELECT id
FROM dbo.SalesDates s
WHERE '2012/1/03' IN (SELECT saledate FROM SalesDates);
is equivalent to the one given in the QotD. If you try for the example dates, it produces the same results as with ANY and SOME.
(http://msdn.microsoft.com/en-us/library/ms177682.aspx)
Igor Micev,My blog: www.igormicev.com
March 21, 2012 at 2:55 am
Good question. I have never used ANY or SOME in queries so have learned something once again.
March 21, 2012 at 3:54 am
The good thing in ANY or SOME is that you can make all kind of comparison not only equality or inequality.
March 21, 2012 at 6:29 am
Nice question on a little known (and, frankly, barely useful) feature.
Too bad it is hampered by the all too common mistake of depending on a time format. In some regions of the world, the test table has data for January 1st, February 1st, March 1st, and May 1st.
#FeelingLikeBrokenRecord
March 21, 2012 at 6:45 am
Hugo Kornelis (3/21/2012)
Nice question on a little known (and, frankly, barely useful) feature.Too bad it is hampered by the all too common mistake of depending on a time format. In some regions of the world, the test table has data for January 1st, February 1st, March 1st, and May 1st.
#FeelingLikeBrokenRecord
Hugo, According to my reading... this question doesn't care which date format (other than the answer that specifies Jan 3rd) it is using. In most, if not all, regions I would suppose that it would return all dates.
March 21, 2012 at 7:14 am
venoym (3/21/2012)
Hugo Kornelis (3/21/2012)
Nice question on a little known (and, frankly, barely useful) feature.Too bad it is hampered by the all too common mistake of depending on a time format. In some regions of the world, the test table has data for January 1st, February 1st, March 1st, and May 1st.
#FeelingLikeBrokenRecord
Hugo, According to my reading... this question doesn't care which date format (other than the answer that specifies Jan 3rd) it is using. In most, if not all, regions I would suppose that it would return all dates.
True; for those who blindly copy and paste the code, it will not make a difference. To those who try to work out the answer in their head, it may make a difference if they see the "Jan 3" in the text of the question.
Until I discovered the "incorrect" use of ANY and realised that this is what the question is about, I suspected that the question might be a trick question on date formats.
March 21, 2012 at 8:02 am
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?
Viewing 15 posts - 1 through 15 (of 34 total)
You must be logged in to reply to this topic. Login to reply