February 25, 2014 at 8:05 pm
Comments posted to this topic are about the item Intersecting - 1
February 25, 2014 at 10:28 pm
Intersecting question thanks 😉
Hope this helps...
Ford Fairlane
Rock and Roll Detective
February 26, 2014 at 12:09 am
Thanks Ron
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 26, 2014 at 12:47 am
Easy one, thanks!
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
February 26, 2014 at 1:05 am
This was removed by the editor as SPAM
February 26, 2014 at 1:17 am
First time I see 99% OK.
😀
February 26, 2014 at 1:58 am
2 points!
February 26, 2014 at 3:14 am
I had to go and run this one because I couldn't believe the answer was as simple as it first appeared. Lo and behold, it *was* that simple! :laugh:
February 26, 2014 at 3:17 am
Of course the correct answer isn't an option. It fails with an error saying that column X does not exist...
February 26, 2014 at 3:22 am
Toreador (2/26/2014)
Of course the correct answer isn't an option. It fails with an error saying that column X does not exist...
Depends on the collation setting for the database, doesn't it? I believe the default install option is for a case-insensitive collation, in which case, the script as presented works fine.
February 26, 2014 at 4:01 am
Wow, like being back at school in 1972...
February 26, 2014 at 5:29 am
Nice and simple, but it's been a long while since I've seen a question on INTERSECT or EXCEPT. Thanks.
February 26, 2014 at 7:41 am
Equivalent to:
SELECT X AS 'Intersecting'
FROM A
JOIN b ON b.y = a.x;
Except the ordering. INTERSECT returns the values in numeric order; JOIN returns the values in the order in which they were found in the left table (A).
I didn't see anything in the BOL documentation on this. Anyone shed some light on this? Thanks.
February 26, 2014 at 8:01 am
Thanks for the question Ron. Here lately intersect and except are two of my most used commands; I didn't even look for the got'cha in this one. 🙂
February 26, 2014 at 8:05 am
RLilj33 (2/26/2014)
Equivalent to:SELECT X AS 'Intersecting'
FROM A
JOIN b ON b.y = a.x;
Except the ordering. INTERSECT returns the values in numeric order; JOIN returns the values in the order in which they were found in the left table (A).
I didn't see anything in the BOL documentation on this. Anyone shed some light on this? Thanks.
Neither version is guaranteed to return the values in any particular order. The results you are seeing are determined purely by the plan that the optimiser chooses - this could change with different volumes of data, or between different versions of SQLServer, etc.
The only way to guarantee a particular sequence is to specify an Order By clause.
Viewing 15 posts - 1 through 15 (of 30 total)
You must be logged in to reply to this topic. Login to reply