我认为有人写了一个过于复杂的查询。 我不太明白最后“AS”的意义。 基本上我可以在这个脚本中看到两个子查询。 为了减少它,我只包括一列。
SELECT [tableau_fact_group_committee_pl_agg].[dim_div_mgmt_key] AS [dim_div_mgmt_key] FROM ( SELECT fact_group_pl_agg.[dim_div_mgmt_key] FROM fact_group_pl_agg join dbo.dim_DIV_MGMT_v d on fact_group_pl_agg.dim_div_mgmt_key = d.dim_div_mgmt_key WHERE EXIST (SUB QUERY 2: SELECT FROM WHERE) ) AS [tableau_fact_group_committee_pl_agg] INNER JOIN table 1 on col1 = col2 INNER JOIN table 2 on col3 = col4任何人都可以告诉我“AS [tableau_fact_group_committee_pl_agg] INNER JOIN”对查询做了什么? 跟随子查询很简单,因为它只是使数据集每次都变小。 但是我从“AS”开始不遵循任何事情。 谢谢。
I think someone wrote an overly complicated query. I don't quite understand what the point of 'AS' at the end. Essentially I can see two subqueries in this script. To cut it down I've just included one column.
SELECT [tableau_fact_group_committee_pl_agg].[dim_div_mgmt_key] AS [dim_div_mgmt_key] FROM ( SELECT fact_group_pl_agg.[dim_div_mgmt_key] FROM fact_group_pl_agg join dbo.dim_DIV_MGMT_v d on fact_group_pl_agg.dim_div_mgmt_key = d.dim_div_mgmt_key WHERE EXIST (SUB QUERY 2: SELECT FROM WHERE) ) AS [tableau_fact_group_committee_pl_agg] INNER JOIN table 1 on col1 = col2 INNER JOIN table 2 on col3 = col4Can anyone please tell me what "AS [tableau_fact_group_committee_pl_agg] INNER JOIN" does to the query? It's simple to follow the subqueries, as it is just making the data set smaller each time. But I don't follow anything beginning from "AS". Thank you.
最满意答案
AS用于引入别名,即另一个名称,无论是列还是查询结果。 在这种情况下,查询的结果集(SELECT fact_group_pl_agg.[dim_div_mgmt_key] ...)被赋予别名[tableau_fact_group_committee_pl_agg] 。
之后, INNER JOIN子句只是将第一个查询的结果集连接到具有指定条件的指定表。
AS is used to introduce an alias i.e. another name, be it for a column or the results of a query. In this case, the result set of the query (SELECT fact_group_pl_agg.[dim_div_mgmt_key] ...) is given the alias [tableau_fact_group_committee_pl_agg].
After that, the INNER JOIN clauses simply join the result set of the first query to the specified tables with the specified conditions.
更多推荐
发布评论