-
Notifications
You must be signed in to change notification settings - Fork 13
Select as subquery
Tako Lee edited this page Mar 6, 2014
·
16 revisions
-
Subquery at the same line with IN keyword
Option: fmt032_subquery_in_newline = false, type: TFmtBoolean.
SELECT SUM (Sales) FROM Store_Information WHERE Store_Name IN (SELECT Store_Name FROM Geography WHERE Region_Name = 'West');
-
Subquery in new line after IN keyword
Option: fmt032_subquery_in_newline = true, type: TFmtBoolean.
-
Start parenthesis in not in newline
Option: fmt033_subquery_start_parenthesis_in_newline = false, type: TFmtBoolean.
Option: fmt037_subquery_select_keyword_in_newline = true, type: TFmtBoolean.
Option: fmt038_subquery_select_keyword_indent = n, type: TFmtBoolean.
SELECT SUM (Sales) FROM Store_Information WHERE Store_Name IN ( SELECT Store_Name FROM Geography WHERE Region_Name = 'West');
-
-
Subquery in the same line with EXISTS keyword
SELECT SUM(Sales) FROM Store_Information WHERE EXISTS (SELECT * FROM Geography WHERE Region_Name = 'West');
-
Subquery in new line after EXISTS keyword
SELECT SUM(Sales) FROM Store_Information WHERE EXISTS (SELECT * FROM Geography WHERE Region_Name = 'West');
-
Subquery in the same line with comparison operator
SELECT SUM (Sales) FROM Store_Information WHERE Store_Name = (SELECT Store_Name FROM Geography WHERE Region_Name = 'West');
-
Subquery in new line after comparison operator
SELECT SUM (Sales) FROM Store_Information WHERE Store_Name = (SELECT Store_Name FROM Geography WHERE Region_Name = 'West');
-
Put comparison operator after subquery into new line
SELECT [CategoryID] AS [CategoryId], FROM [dbo].[Categories] WHERE (SELECT Sum([LPA_L1].[UnitsInStock]) AS [LPAV_] FROM (SELECT [CategoryID] AS [CategoryId], FROM [dbo].[Products] WHERE [Products].[CategoryID] = [Categories].[CategoryID] ) [LPA_L1]) > @p2