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 |
SQLBoy14
Yak Posting Veteran
70 Posts |
Posted - 2014-11-19 : 20:58:32
|
Hello all SQL expert,I understand all about joins but I am wondering, when you have to write a stored procedure that involves 10 different tables, which table do you choose as the main table to FROM statement? For example, let's say, you assigned to write a query to do a report and you need to extract the data from 10 different tables. What is the main table? Once I figure which table on my main table then I can easily just do (either) INNER, LEFT OUTER or RIGHT OUTER JOIN. Anyone can give me a better understanding of this concept?SQLBoy |
|
SQLBoy14
Yak Posting Veteran
70 Posts |
Posted - 2014-11-19 : 22:17:04
|
What I am trying to understand is, from all the 10 tables, what table I should start first on the FROM section? Can I start from any table then work on the joins? either Inner, Left or right outer joins? I just wasn't sure if I have to start write the query from the beginning, which table I start with?SQLBoy |
|
|
Blessed1978
Yak Posting Veteran
97 Posts |
Posted - 2014-11-19 : 22:24:15
|
you have to make sure that the columns you are joining on are unique and the values (keys) from your source table can be found in your target table. you can join on any table as long as the values(keys) can be mapped. hopefully this helps |
|
|
|
|
|