Sub Query然后使用AS加入(Sub Query and then use AS with join)

编程入门 行业动态 更新时间:2024-10-24 03:26:00
Sub Query然后使用AS加入(Sub Query and then use AS with join)

我认为有人写了一个过于复杂的查询。 我不太明白最后“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 = col4

Can 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.

更多推荐

本文发布于:2023-08-03 08:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1385263.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Query   join

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!