Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
grandhi
Starting Member
31 Posts |
Posted - 2013-05-15 : 02:00:34
|
Hi All, I want to write Intersect query with 3 different tables,for that purpose I wrote the following code. select DataElement2 from test intersect select DataElement2 from test2 intersect select DataElement2 from test3 it's working fine,But I have a doubt about,is it right what I mention in below.In my point of view the entire above query consider as a single query.Once we send the query to SQL,I think SQL understood as Three queries.Is it right,What I am Thinking.like this I want to know If we use Joins between different tables.How SQl will understood.I hope,you understand my question.Fell Free,If you want to edit my question.Thank you. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-15 : 02:09:42
|
The query engine will break it down into individual queries, fetch result for each and then apply intersect operator over them to give you the common values present.In comparison, in a join the query engine fetches all the records from involved tables based on join condition and give you merged resultTo get exact sequence you can run the query with "display actual execution plan" option on on SSMS and it will give you graphical representataion of actual query plan used in query.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|