Sql SubQuery表别名Access [英] Sql SubQuery Table alias Access
本文介绍了Sql SubQuery表别名Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在外部查询中访问内部子查询表(类别为c,产品为p)别名。
这是我的查询;
选择 p。*,p.Price,p。数量为 TotalPrice,c.Name as CategoryName 来自
(
select Row_number() over ( order by p.ProductId) as RowNo,p。*,p.Price * p.Quantity as TotalPrice ,c.Name as CategoryName 来自
类别 as c
inner join 产品 as p
on c.Produ ctId = p.ProductId
)ProductCategory
解决方案
因为您将其别名为ProductCategory,所以您将如何访问它。 / BLOCKQUOTE>
How to access inner subquery tables(Category as c and Product as p) alias in outer query.
Here is my Query;
select p.*,p.Price,p.Quantity as TotalPrice,c.Name as CategoryName from ( select Row_number() over (order by p.ProductId) as RowNo, p.*,p.Price*p.Quantity as TotalPrice,c.Name as CategoryName from Category as c inner join Product as p on c.ProductId=p.ProductId ) ProductCategory解决方案Since you aliased it as ProductCategory that is how you would access it.
这篇关于Sql SubQuery表别名Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文