FAQ/Questions/Different-Join-Types-and-Filters.md
... ...
@@ -0,0 +1,89 @@
1
+###SQL Samples of Various Join Types
2
+
3
+**Inner (Direct) Join:**  Selects rows from two tables such that the value in one column of the first table also appears in a column of the second table.  
4
+
5
+```sql
6
+SELECT DISTINCT 
7
+[dbo].[Invoices].[CustomerName] AS 'Customer Name'
8
+FROM [dbo].[Orders]
9
+INNER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
10
+```
11
+
12
+**Cross Join:** A cross join will return a result table where each row from the first table is combined with each row from the second table. 
13
+
14
+```sql
15
+SELECT DISTINCT 
16
+[dbo].[Invoices].[CustomerName] AS 'Customer Name'
17
+FROM [dbo].[Orders]
18
+CROSS JOIN [dbo].[Invoices];
19
+```
20
+
21
+**Left(First Exists) Join:** The Left Outer Join known also as Left Join returns all rows from the left table in the Left Outer Join clause, no matter if the joined columns match.  A field in a result row will be null if the corresponding input table did not contain a matching row.
22
+
23
+```sql
24
+SELECT DISTINCT 
25
+[dbo].[Invoices].[CustomerName] AS 'Customer Name'
26
+FROM [dbo].[Orders]
27
+LEFT OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
28
+```
29
+
30
+**Right Join:** The Right Outer Join known also as Right Join returns all rows from the right table in the Right Outer Join clause, no matter if the joined columns match.  A field in a result row will be null if the corresponding input table did not contain a matching row.
31
+
32
+```sql
33
+SELECT DISTINCT 
34
+[dbo].[Invoices].[CustomerName] AS 'Customer Name'
35
+FROM [dbo].[Orders]
36
+RIGHT OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
37
+```
38
+
39
+**Full Join:** The Full Outer Join known also as Full Join returns all rows from Both the Right Outer Join & Left Outer Join.  A field in a result row will be null if the corresponding input table did not contain a matching row.
40
+
41
+```sql
42
+SELECT DISTINCT 
43
+[dbo].[Invoices].[CustomerName] AS 'Customer Name'
44
+FROM [dbo].[Orders]
45
+FULL OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
46
+```
47
+
48
+##Filters and Join Types
49
+
50
+If you specify a [[filter|http://wiki.izenda.us/Guides/ReportDesign/5.0-Filters-tab]] for the column in first(left) table in JOIN clause, all filters will be applied as usual (i.e. all filters will be in the WHERE clause):
51
+
52
+```sql
53
+SELECT
54
+[dbo].[Order Details].[Discount],
55
+[dbo].[Orders].[OrderID]
56
+FROM [dbo].[Order Details]
57
+LEFT OUTER JOIN [dbo].[Orders] ON [dbo].[Orders].[OrderID]=[dbo].[Order Details].[OrderID]
58
+WHERE [dbo].[Order Details].[OrderID] = 10248
59
+```
60
+
61
+Now let's say we want to specify filter for the column in the second(right) table. In this case, we should add this filter to the JOIN clause itself:
62
+
63
+```sql
64
+SELECT
65
+[dbo].[Order Details].[Discount],
66
+[dbo].[Orders].[OrderID]
67
+FROM [dbo].[Order Details]
68
+LEFT OUTER JOIN [dbo].[Orders] ON [dbo].[Orders].[OrderID]=[dbo].[Order Details].[OrderID] AND [dbo].[Orders].[OrderID] = 10248
69
+```
70
+
71
+The reason why we shouldn't place the filter in the WHERE clause is that it will transform our **LEFT OUTER JOIN** to an **INNER JOIN**. For example, when you use "WHERE [dbo].[Order Details].[OrderID] = 10248", you remove all NULLs from the results (obviously NULL doesn't equal 10248). To avoid this (to retain NULLs in the results) we should follow ANSI-92 SQL syntax and use conditional joins.
72
+
73
+We can also use an inner query to apply our outer left join:
74
+
75
+```sql
76
+SELECT
77
+[dbo].[Order Details].[Discount],
78
+Ord.[OrderID]
79
+FROM [dbo].[Order Details]
80
+LEFT OUTER JOIN
81
+(SELECT * FROM [dbo].[Orders]
82
+WHERE [dbo].[Orders].[OrderID] = 10248) AS Ord
83
+ON Ord.[OrderID]=[dbo].[Order Details].[OrderID]
84
+```
85
+
86
+When we apply filters within the JOIN clause, it's like we applied these filters separately to the table, and then added them to the JOIN. This can help speedup database performance. Please refer to the articles below for more information:
87
+
88
+* [[ANSI SQL-92 Standard|http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt]]
89
+* [[MSDN article about OUTER joins|http://msdn.microsoft.com/en-us/library/aa213228]]
... ...
\ No newline at end of file
Integration/Tutorials/Appearance.md
... ...
@@ -1,89 +0,0 @@
1
-###SQL Samples of Various Join Types
2
-
3
-**Inner (Direct) Join:**  Selects rows from two tables such that the value in one column of the first table also appears in a column of the second table.  
4
-
5
-```sql
6
-SELECT DISTINCT 
7
-[dbo].[Invoices].[CustomerName] AS 'Customer Name'
8
-FROM [dbo].[Orders]
9
-INNER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
10
-```
11
-
12
-**Cross Join:** A cross join will return a result table where each row from the first table is combined with each row from the second table. 
13
-
14
-```sql
15
-SELECT DISTINCT 
16
-[dbo].[Invoices].[CustomerName] AS 'Customer Name'
17
-FROM [dbo].[Orders]
18
-CROSS JOIN [dbo].[Invoices];
19
-```
20
-
21
-**Left(First Exists) Join:** The Left Outer Join known also as Left Join returns all rows from the left table in the Left Outer Join clause, no matter if the joined columns match.  A field in a result row will be null if the corresponding input table did not contain a matching row.
22
-
23
-```sql
24
-SELECT DISTINCT 
25
-[dbo].[Invoices].[CustomerName] AS 'Customer Name'
26
-FROM [dbo].[Orders]
27
-LEFT OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
28
-```
29
-
30
-**Right Join:** The Right Outer Join known also as Right Join returns all rows from the right table in the Right Outer Join clause, no matter if the joined columns match.  A field in a result row will be null if the corresponding input table did not contain a matching row.
31
-
32
-```sql
33
-SELECT DISTINCT 
34
-[dbo].[Invoices].[CustomerName] AS 'Customer Name'
35
-FROM [dbo].[Orders]
36
-RIGHT OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
37
-```
38
-
39
-**Full Join:** The Full Outer Join known also as Full Join returns all rows from Both the Right Outer Join & Left Outer Join.  A field in a result row will be null if the corresponding input table did not contain a matching row.
40
-
41
-```sql
42
-SELECT DISTINCT 
43
-[dbo].[Invoices].[CustomerName] AS 'Customer Name'
44
-FROM [dbo].[Orders]
45
-FULL OUTER JOIN [dbo].[Invoices] ON [dbo].[Invoices].[CustomerID]=[dbo].[Orders].[CustomerID];
46
-```
47
-
48
-##Filters and Join Types
49
-
50
-If you specify a [[filter|http://wiki.izenda.us/Guides/ReportDesign/5.0-Filters-tab]] for the column in first(left) table in JOIN clause, all filters will be applied as usual (i.e. all filters will be in the WHERE clause):
51
-
52
-```sql
53
-SELECT
54
-[dbo].[Order Details].[Discount],
55
-[dbo].[Orders].[OrderID]
56
-FROM [dbo].[Order Details]
57
-LEFT OUTER JOIN [dbo].[Orders] ON [dbo].[Orders].[OrderID]=[dbo].[Order Details].[OrderID]
58
-WHERE [dbo].[Order Details].[OrderID] = 10248
59
-```
60
-
61
-Now let's say we want to specify filter for the column in the second(right) table. In this case, we should add this filter to the JOIN clause itself:
62
-
63
-```sql
64
-SELECT
65
-[dbo].[Order Details].[Discount],
66
-[dbo].[Orders].[OrderID]
67
-FROM [dbo].[Order Details]
68
-LEFT OUTER JOIN [dbo].[Orders] ON [dbo].[Orders].[OrderID]=[dbo].[Order Details].[OrderID] AND [dbo].[Orders].[OrderID] = 10248
69
-```
70
-
71
-The reason why we shouldn't place the filter in the WHERE clause is that it will transform our **LEFT OUTER JOIN** to an **INNER JOIN**. For example, when you use "WHERE [dbo].[Order Details].[OrderID] = 10248", you remove all NULLs from the results (obviously NULL doesn't equal 10248). To avoid this (to retain NULLs in the results) we should follow ANSI-92 SQL syntax and use conditional joins.
72
-
73
-We can also use an inner query to apply our outer left join:
74
-
75
-```sql
76
-SELECT
77
-[dbo].[Order Details].[Discount],
78
-Ord.[OrderID]
79
-FROM [dbo].[Order Details]
80
-LEFT OUTER JOIN
81
-(SELECT * FROM [dbo].[Orders]
82
-WHERE [dbo].[Orders].[OrderID] = 10248) AS Ord
83
-ON Ord.[OrderID]=[dbo].[Order Details].[OrderID]
84
-```
85
-
86
-When we apply filters within the JOIN clause, it's like we applied these filters separately to the table, and then added them to the JOIN. This can help speedup database performance. Please refer to the articles below for more information:
87
-
88
-* [[ANSI SQL-92 Standard|http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt]]
89
-* [[MSDN article about OUTER joins|http://msdn.microsoft.com/en-us/library/aa213228]]
... ...
\ No newline at end of file